@aptos-labs/ts-sdk 1.32.1 → 1.33.0-sc.1
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-6RqI8Aam.d.ts → accountAddress-fJZJVSBc.d.ts} +2 -1
- package/dist/common/chunk-F43XVDYJ.js.map +1 -1
- package/dist/common/cli/index.d.ts +10 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +127 -14
- package/dist/common/index.js +31 -31
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +1 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +1 -0
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +1 -0
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +1 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +1 -0
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +1 -0
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +1 -0
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +1 -0
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +1 -0
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +1 -0
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +2 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -0
- package/dist/esm/api/coin.d.mts +1 -0
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +1 -0
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +1 -0
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +1 -0
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +1 -0
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -0
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +2 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +1 -0
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +1 -0
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -0
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -0
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +66 -0
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +10 -8
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -0
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.d.mts +1 -0
- package/dist/esm/bcs/deserializer.d.mts +1 -0
- package/dist/esm/bcs/index.d.mts +1 -0
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -0
- package/dist/esm/{chunk-RC43EXC4.mjs → chunk-2CKUTG67.mjs} +2 -2
- package/dist/esm/{chunk-UKVH4UGL.mjs → chunk-2E3EAJPC.mjs} +2 -2
- package/dist/esm/{chunk-KCEI5JYS.mjs → chunk-2G7SAWM3.mjs} +2 -2
- package/dist/esm/chunk-2WLKSKL7.mjs +2 -0
- package/dist/esm/chunk-2WLKSKL7.mjs.map +1 -0
- package/dist/esm/{chunk-O4MRRWRI.mjs → chunk-362NFXZR.mjs} +2 -2
- package/dist/esm/{chunk-ML7D2CVG.mjs → chunk-3BWKODVZ.mjs} +2 -2
- package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
- package/dist/esm/chunk-3OLFJ65O.mjs.map +1 -0
- package/dist/esm/{chunk-ETF76XA3.mjs → chunk-3QIOEU3Z.mjs} +2 -2
- package/dist/esm/{chunk-SY4HK6CC.mjs → chunk-3QUZFCNW.mjs} +2 -2
- package/dist/esm/chunk-3QUZFCNW.mjs.map +1 -0
- package/dist/esm/{chunk-H7AALSJ7.mjs → chunk-3TOPGQJA.mjs} +2 -2
- package/dist/esm/{chunk-AGEJNSEX.mjs → chunk-4JX6OQEE.mjs} +2 -2
- package/dist/esm/{chunk-MBEWPBGN.mjs → chunk-4ZNSNWQL.mjs} +2 -2
- package/dist/esm/{chunk-EJKX6MGV.mjs → chunk-554TWPPO.mjs} +2 -2
- package/dist/esm/{chunk-KM6IOJ6Y.mjs → chunk-5XLZACVT.mjs} +2 -2
- package/dist/esm/{chunk-NF7ZQQE3.mjs → chunk-6EVBSHT2.mjs} +2 -2
- package/dist/esm/{chunk-JONEH52T.mjs → chunk-6YFM6NEC.mjs} +2 -2
- package/dist/esm/{chunk-TGW36YOD.mjs → chunk-77ILVREP.mjs} +2 -2
- package/dist/esm/{chunk-4IQZOAN7.mjs → chunk-7BKLEHKL.mjs} +2 -2
- package/dist/esm/{chunk-FFCCBAEZ.mjs → chunk-7CDITZUS.mjs} +2 -2
- package/dist/esm/{chunk-JIT2FYGE.mjs → chunk-7R44XXPU.mjs} +2 -2
- package/dist/esm/chunk-A7KFSQSE.mjs +2 -0
- package/dist/esm/chunk-A7KFSQSE.mjs.map +1 -0
- package/dist/esm/{chunk-HBWIDPNN.mjs → chunk-AOQJI6IC.mjs} +2 -2
- package/dist/esm/{chunk-U3GE6IPF.mjs → chunk-AR6BOLET.mjs} +2 -2
- package/dist/esm/{chunk-TQA6HY6A.mjs → chunk-B2OF42B3.mjs} +2 -2
- package/dist/esm/{chunk-4J2JYRV3.mjs → chunk-B6ERS4UX.mjs} +2 -2
- package/dist/esm/{chunk-YP3VO6GM.mjs → chunk-BKSQPS2O.mjs} +2 -2
- package/dist/esm/{chunk-JGLEKXFP.mjs → chunk-BVUMR7DQ.mjs} +2 -2
- package/dist/esm/{chunk-LHBMBCFC.mjs → chunk-BZ7OCXLM.mjs} +2 -2
- package/dist/esm/{chunk-HPZQGMSH.mjs → chunk-CK5NDXQT.mjs} +2 -2
- package/dist/esm/{chunk-BP45UJII.mjs → chunk-CW6P2DDJ.mjs} +2 -2
- package/dist/esm/{chunk-KX43GEAB.mjs → chunk-D6WMUQB5.mjs} +2 -2
- package/dist/esm/{chunk-2REHS35S.mjs → chunk-DBAISV4K.mjs} +2 -2
- package/dist/esm/chunk-EPBNJZ4A.mjs +2 -0
- package/dist/esm/chunk-EPBNJZ4A.mjs.map +1 -0
- package/dist/esm/{chunk-7OHMMGS6.mjs → chunk-EVA2SMAU.mjs} +2 -2
- package/dist/esm/{chunk-P2FTRAK3.mjs → chunk-EVASO3UR.mjs} +2 -2
- package/dist/esm/{chunk-5O3RHPER.mjs → chunk-FFBC7GFN.mjs} +2 -2
- package/dist/esm/chunk-FZDEGDUY.mjs +2 -0
- package/dist/esm/{chunk-AITN3DO4.mjs.map → chunk-FZDEGDUY.mjs.map} +1 -1
- package/dist/esm/{chunk-OVI7L7OG.mjs → chunk-H6RW3TML.mjs} +2 -2
- package/dist/esm/{chunk-FYYTCJS4.mjs → chunk-HXCL6KBW.mjs} +2 -2
- package/dist/esm/chunk-IHGA5KAD.mjs +2 -0
- package/dist/esm/{chunk-I2NMCLNW.mjs.map → chunk-IHGA5KAD.mjs.map} +1 -1
- package/dist/esm/{chunk-RLH25IDA.mjs → chunk-IIV42FZR.mjs} +2 -2
- package/dist/esm/{chunk-RSO5YIDW.mjs → chunk-IKJAX5KQ.mjs} +2 -2
- package/dist/esm/{chunk-UWLW2VLZ.mjs → chunk-IZ3I5XZU.mjs} +2 -2
- package/dist/esm/{chunk-5KCKWL2C.mjs → chunk-J2NQJ34O.mjs} +2 -2
- package/dist/esm/chunk-J45GIVXE.mjs +2 -0
- package/dist/esm/chunk-J45GIVXE.mjs.map +1 -0
- package/dist/esm/{chunk-LYO22HMF.mjs → chunk-JJXLJY37.mjs} +2 -2
- package/dist/esm/{chunk-CPKG25HX.mjs → chunk-LRN4ALMT.mjs} +2 -2
- package/dist/esm/{chunk-ERDYU5YQ.mjs → chunk-MKM5MDD5.mjs} +2 -2
- package/dist/esm/{chunk-GZBVXXUL.mjs → chunk-NNWPYX3K.mjs} +2 -2
- package/dist/esm/{chunk-A3USS2NC.mjs → chunk-OZK26LTY.mjs} +2 -2
- package/dist/esm/{chunk-SPX2YFZN.mjs → chunk-P6RNNESB.mjs} +2 -2
- package/dist/esm/chunk-PC4HNMCP.mjs +2 -0
- package/dist/esm/chunk-PC4HNMCP.mjs.map +1 -0
- package/dist/esm/{chunk-VGITSRT6.mjs → chunk-PMA7XAFK.mjs} +2 -2
- package/dist/esm/{chunk-WYOFF5DJ.mjs → chunk-QCIRC2SG.mjs} +2 -2
- package/dist/esm/{chunk-CEW2NI3K.mjs → chunk-S22QVNK7.mjs} +2 -2
- package/dist/esm/{chunk-K62JTXWQ.mjs → chunk-SHAKBL2R.mjs} +2 -2
- package/dist/esm/{chunk-X7JNNNMC.mjs → chunk-SOLRIYPW.mjs} +2 -2
- package/dist/esm/{chunk-IQ4SCMB6.mjs → chunk-T7BTSSX7.mjs} +2 -2
- package/dist/esm/{chunk-IUSAYAEI.mjs → chunk-TE3SBS7J.mjs} +2 -2
- package/dist/esm/chunk-U2PRGW4O.mjs +2 -0
- package/dist/esm/chunk-U2PRGW4O.mjs.map +1 -0
- package/dist/esm/{chunk-L25CRR2W.mjs → chunk-U7UTBXJD.mjs} +2 -2
- package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
- package/dist/esm/{chunk-2LQ4FTSR.mjs → chunk-UQIMOQZ7.mjs} +2 -2
- package/dist/esm/{chunk-I5GENJBA.mjs → chunk-UTOO6IVJ.mjs} +2 -2
- package/dist/esm/{chunk-D54FD6XE.mjs → chunk-WIDWY7A2.mjs} +2 -2
- package/dist/esm/{chunk-E2GPZCQI.mjs → chunk-WJSZAGHP.mjs} +2 -2
- package/dist/esm/{chunk-II26BNYA.mjs → chunk-XEW2YQE2.mjs} +2 -2
- package/dist/esm/chunk-XEW2YQE2.mjs.map +1 -0
- package/dist/esm/chunk-YQHOQJRQ.mjs +2 -0
- package/dist/esm/{chunk-RZGTHCJY.mjs.map → chunk-YQHOQJRQ.mjs.map} +1 -1
- package/dist/esm/{chunk-LGHPJTF3.mjs → chunk-YT3IP57B.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +10 -0
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.d.mts +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -0
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +1 -0
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +1 -0
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -0
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -0
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -0
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -0
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -0
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +1 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -0
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +1 -0
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -0
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -0
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -0
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -0
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -0
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +1 -0
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -0
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -0
- package/dist/esm/core/hex.d.mts +1 -0
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +1 -0
- package/dist/esm/index.d.mts +5 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +1 -0
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -0
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -0
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +1 -0
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -0
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +1 -0
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +1 -0
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +1 -0
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +1 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +1 -0
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -0
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -0
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +11 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +2 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +5 -3
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -0
- package/dist/esm/transactions/instances/identifier.d.mts +1 -0
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -0
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +1 -0
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/script-composer/index.d.mts +44 -0
- package/dist/esm/transactions/script-composer/index.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +23 -2
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -0
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +13 -3
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/types.d.mts +3 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +1 -0
- package/dist/esm/utils/index.d.mts +1 -0
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +1 -0
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -1
- package/src/api/transactionSubmission/build.ts +82 -1
- package/src/api/transactionSubmission/helpers.ts +0 -6
- package/src/api/transactionSubmission/simulate.ts +9 -8
- package/src/cli/move.ts +16 -0
- package/src/internal/transactionSubmission.ts +1 -1
- package/src/transactions/authenticator/account.ts +19 -0
- package/src/transactions/index.ts +1 -0
- package/src/transactions/script-composer/index.ts +76 -0
- package/src/transactions/transactionBuilder/remoteAbi.ts +55 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -17
- package/src/transactions/types.ts +14 -2
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +1 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-26WX3UFP.mjs +0 -2
- package/dist/esm/chunk-26WX3UFP.mjs.map +0 -1
- package/dist/esm/chunk-AITN3DO4.mjs +0 -2
- package/dist/esm/chunk-DYELAVMR.mjs +0 -2
- package/dist/esm/chunk-DYELAVMR.mjs.map +0 -1
- package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
- package/dist/esm/chunk-I2NMCLNW.mjs +0 -2
- package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
- package/dist/esm/chunk-II26BNYA.mjs.map +0 -1
- package/dist/esm/chunk-KTM6KVUJ.mjs +0 -2
- package/dist/esm/chunk-KTM6KVUJ.mjs.map +0 -1
- package/dist/esm/chunk-RZGTHCJY.mjs +0 -2
- package/dist/esm/chunk-SY4HK6CC.mjs.map +0 -1
- package/dist/esm/chunk-WQF3IOXC.mjs +0 -2
- package/dist/esm/chunk-WQF3IOXC.mjs.map +0 -1
- package/dist/esm/chunk-XIB6LX22.mjs +0 -2
- package/dist/esm/chunk-XIB6LX22.mjs.map +0 -1
- /package/dist/esm/{chunk-RC43EXC4.mjs.map → chunk-2CKUTG67.mjs.map} +0 -0
- /package/dist/esm/{chunk-UKVH4UGL.mjs.map → chunk-2E3EAJPC.mjs.map} +0 -0
- /package/dist/esm/{chunk-KCEI5JYS.mjs.map → chunk-2G7SAWM3.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4MRRWRI.mjs.map → chunk-362NFXZR.mjs.map} +0 -0
- /package/dist/esm/{chunk-ML7D2CVG.mjs.map → chunk-3BWKODVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ETF76XA3.mjs.map → chunk-3QIOEU3Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-H7AALSJ7.mjs.map → chunk-3TOPGQJA.mjs.map} +0 -0
- /package/dist/esm/{chunk-AGEJNSEX.mjs.map → chunk-4JX6OQEE.mjs.map} +0 -0
- /package/dist/esm/{chunk-MBEWPBGN.mjs.map → chunk-4ZNSNWQL.mjs.map} +0 -0
- /package/dist/esm/{chunk-EJKX6MGV.mjs.map → chunk-554TWPPO.mjs.map} +0 -0
- /package/dist/esm/{chunk-KM6IOJ6Y.mjs.map → chunk-5XLZACVT.mjs.map} +0 -0
- /package/dist/esm/{chunk-NF7ZQQE3.mjs.map → chunk-6EVBSHT2.mjs.map} +0 -0
- /package/dist/esm/{chunk-JONEH52T.mjs.map → chunk-6YFM6NEC.mjs.map} +0 -0
- /package/dist/esm/{chunk-TGW36YOD.mjs.map → chunk-77ILVREP.mjs.map} +0 -0
- /package/dist/esm/{chunk-4IQZOAN7.mjs.map → chunk-7BKLEHKL.mjs.map} +0 -0
- /package/dist/esm/{chunk-FFCCBAEZ.mjs.map → chunk-7CDITZUS.mjs.map} +0 -0
- /package/dist/esm/{chunk-JIT2FYGE.mjs.map → chunk-7R44XXPU.mjs.map} +0 -0
- /package/dist/esm/{chunk-HBWIDPNN.mjs.map → chunk-AOQJI6IC.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3GE6IPF.mjs.map → chunk-AR6BOLET.mjs.map} +0 -0
- /package/dist/esm/{chunk-TQA6HY6A.mjs.map → chunk-B2OF42B3.mjs.map} +0 -0
- /package/dist/esm/{chunk-4J2JYRV3.mjs.map → chunk-B6ERS4UX.mjs.map} +0 -0
- /package/dist/esm/{chunk-YP3VO6GM.mjs.map → chunk-BKSQPS2O.mjs.map} +0 -0
- /package/dist/esm/{chunk-JGLEKXFP.mjs.map → chunk-BVUMR7DQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LHBMBCFC.mjs.map → chunk-BZ7OCXLM.mjs.map} +0 -0
- /package/dist/esm/{chunk-HPZQGMSH.mjs.map → chunk-CK5NDXQT.mjs.map} +0 -0
- /package/dist/esm/{chunk-BP45UJII.mjs.map → chunk-CW6P2DDJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-KX43GEAB.mjs.map → chunk-D6WMUQB5.mjs.map} +0 -0
- /package/dist/esm/{chunk-2REHS35S.mjs.map → chunk-DBAISV4K.mjs.map} +0 -0
- /package/dist/esm/{chunk-7OHMMGS6.mjs.map → chunk-EVA2SMAU.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2FTRAK3.mjs.map → chunk-EVASO3UR.mjs.map} +0 -0
- /package/dist/esm/{chunk-5O3RHPER.mjs.map → chunk-FFBC7GFN.mjs.map} +0 -0
- /package/dist/esm/{chunk-OVI7L7OG.mjs.map → chunk-H6RW3TML.mjs.map} +0 -0
- /package/dist/esm/{chunk-FYYTCJS4.mjs.map → chunk-HXCL6KBW.mjs.map} +0 -0
- /package/dist/esm/{chunk-RLH25IDA.mjs.map → chunk-IIV42FZR.mjs.map} +0 -0
- /package/dist/esm/{chunk-RSO5YIDW.mjs.map → chunk-IKJAX5KQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWLW2VLZ.mjs.map → chunk-IZ3I5XZU.mjs.map} +0 -0
- /package/dist/esm/{chunk-5KCKWL2C.mjs.map → chunk-J2NQJ34O.mjs.map} +0 -0
- /package/dist/esm/{chunk-LYO22HMF.mjs.map → chunk-JJXLJY37.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPKG25HX.mjs.map → chunk-LRN4ALMT.mjs.map} +0 -0
- /package/dist/esm/{chunk-ERDYU5YQ.mjs.map → chunk-MKM5MDD5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GZBVXXUL.mjs.map → chunk-NNWPYX3K.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3USS2NC.mjs.map → chunk-OZK26LTY.mjs.map} +0 -0
- /package/dist/esm/{chunk-SPX2YFZN.mjs.map → chunk-P6RNNESB.mjs.map} +0 -0
- /package/dist/esm/{chunk-VGITSRT6.mjs.map → chunk-PMA7XAFK.mjs.map} +0 -0
- /package/dist/esm/{chunk-WYOFF5DJ.mjs.map → chunk-QCIRC2SG.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEW2NI3K.mjs.map → chunk-S22QVNK7.mjs.map} +0 -0
- /package/dist/esm/{chunk-K62JTXWQ.mjs.map → chunk-SHAKBL2R.mjs.map} +0 -0
- /package/dist/esm/{chunk-X7JNNNMC.mjs.map → chunk-SOLRIYPW.mjs.map} +0 -0
- /package/dist/esm/{chunk-IQ4SCMB6.mjs.map → chunk-T7BTSSX7.mjs.map} +0 -0
- /package/dist/esm/{chunk-IUSAYAEI.mjs.map → chunk-TE3SBS7J.mjs.map} +0 -0
- /package/dist/esm/{chunk-L25CRR2W.mjs.map → chunk-U7UTBXJD.mjs.map} +0 -0
- /package/dist/esm/{chunk-FD6FGKYY.mjs.map → chunk-UIRAXHDH.mjs.map} +0 -0
- /package/dist/esm/{chunk-2LQ4FTSR.mjs.map → chunk-UQIMOQZ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5GENJBA.mjs.map → chunk-UTOO6IVJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-D54FD6XE.mjs.map → chunk-WIDWY7A2.mjs.map} +0 -0
- /package/dist/esm/{chunk-E2GPZCQI.mjs.map → chunk-WJSZAGHP.mjs.map} +0 -0
- /package/dist/esm/{chunk-LGHPJTF3.mjs.map → chunk-YT3IP57B.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5OYNCZS.mjs.map → transactions/script-composer/index.mjs.map} +0 -0
package/src/cli/move.ts
CHANGED
|
@@ -310,6 +310,22 @@ export class Move {
|
|
|
310
310
|
return this.runCommand(cliArgs, showStdout);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
async gasProfile(args: {
|
|
314
|
+
network: string;
|
|
315
|
+
transactionId: string;
|
|
316
|
+
extraArguments?: Array<string>;
|
|
317
|
+
showStdout?: boolean;
|
|
318
|
+
}): Promise<{ output: string; result?: any }> {
|
|
319
|
+
const { network, transactionId, extraArguments, showStdout } = args;
|
|
320
|
+
const cliArgs = ["aptos", "move", "replay", "--profile-gas", "--network", network, "--txn-id", transactionId];
|
|
321
|
+
|
|
322
|
+
if (extraArguments) {
|
|
323
|
+
cliArgs.push(...extraArguments);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return this.runCommand(cliArgs, showStdout);
|
|
327
|
+
}
|
|
328
|
+
|
|
313
329
|
/**
|
|
314
330
|
* Run a command with the specified arguments and return the output.
|
|
315
331
|
*
|
|
@@ -258,7 +258,7 @@ export function signAsFeePayer(args: { signer: Account; transaction: AnyRawTrans
|
|
|
258
258
|
* @param args The arguments for simulating the transaction.
|
|
259
259
|
* @param args.aptosConfig The configuration for the Aptos network.
|
|
260
260
|
* @param args.transaction The raw transaction to simulate.
|
|
261
|
-
* @param args.signerPublicKey The signer public key.
|
|
261
|
+
* @param args.signerPublicKey Optional. The signer public key.
|
|
262
262
|
* @param args.secondarySignersPublicKeys Optional. For when the transaction involves multiple signers.
|
|
263
263
|
* @param args.feePayerPublicKey Optional. For when the transaction is sponsored by a fee payer.
|
|
264
264
|
* @param args.options Optional. A configuration object to customize the simulation process.
|
|
@@ -37,6 +37,8 @@ export abstract class AccountAuthenticator extends Serializable {
|
|
|
37
37
|
return AccountAuthenticatorSingleKey.load(deserializer);
|
|
38
38
|
case AccountAuthenticatorVariant.MultiKey:
|
|
39
39
|
return AccountAuthenticatorMultiKey.load(deserializer);
|
|
40
|
+
case AccountAuthenticatorVariant.NoAccountAuthenticator:
|
|
41
|
+
return AccountAuthenticatorNoAccountAuthenticator.load(deserializer);
|
|
40
42
|
default:
|
|
41
43
|
throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);
|
|
42
44
|
}
|
|
@@ -218,3 +220,20 @@ export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
|
218
220
|
return new AccountAuthenticatorMultiKey(public_keys, signatures);
|
|
219
221
|
}
|
|
220
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* AccountAuthenticatorNoAccountAuthenticator for no account authenticator
|
|
226
|
+
* It represents the absence of a public key for transaction simulation.
|
|
227
|
+
* It allows skipping the public/auth key check during the simulation.
|
|
228
|
+
*/
|
|
229
|
+
export class AccountAuthenticatorNoAccountAuthenticator extends AccountAuthenticator {
|
|
230
|
+
// eslint-disable-next-line class-methods-use-this
|
|
231
|
+
serialize(serializer: Serializer): void {
|
|
232
|
+
serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.NoAccountAuthenticator);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
236
|
+
static load(deserializer: Deserializer): AccountAuthenticatorNoAccountAuthenticator {
|
|
237
|
+
return new AccountAuthenticatorNoAccountAuthenticator();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { TransactionComposer, initSync, wasm } from "@aptos-labs/script-composer-pack";
|
|
5
|
+
import { AptosApiType } from "../../utils";
|
|
6
|
+
import { AptosConfig } from "../../api/aptosConfig";
|
|
7
|
+
import { InputBatchedFunctionData } from "../types";
|
|
8
|
+
import { fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from "../transactionBuilder";
|
|
9
|
+
import { CallArgument } from "../../types";
|
|
10
|
+
import { convertCallArgument } from "../transactionBuilder/remoteAbi";
|
|
11
|
+
|
|
12
|
+
(async () => {
|
|
13
|
+
initSync({ module: wasm });
|
|
14
|
+
})();
|
|
15
|
+
|
|
16
|
+
// A wrapper class around TransactionComposer, which is a WASM library compiled
|
|
17
|
+
// from aptos-core/aptos-move/script-composer.
|
|
18
|
+
//
|
|
19
|
+
// This class allows the SDK caller to build a transaction that invokes multiple Move functions
|
|
20
|
+
// and allow for arguments to be passed around.
|
|
21
|
+
export class AptosScriptComposer {
|
|
22
|
+
private builder: TransactionComposer;
|
|
23
|
+
|
|
24
|
+
private config: AptosConfig;
|
|
25
|
+
|
|
26
|
+
constructor(aptosConfig: AptosConfig) {
|
|
27
|
+
this.builder = TransactionComposer.single_signer();
|
|
28
|
+
this.config = aptosConfig;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Add a move function invocation to the TransactionComposer.
|
|
32
|
+
//
|
|
33
|
+
// Similar to how to create an entry function, the difference is that input arguments could
|
|
34
|
+
// either be a `CallArgument` which represents an abstract value returned from a previous Move call
|
|
35
|
+
// or the regular entry function arguments.
|
|
36
|
+
//
|
|
37
|
+
// The function would also return a list of `CallArgument` that can be passed on to future calls.
|
|
38
|
+
async addBatchedCalls(input: InputBatchedFunctionData): Promise<CallArgument[]> {
|
|
39
|
+
const { moduleAddress, moduleName, functionName } = getFunctionParts(input.function);
|
|
40
|
+
const nodeUrl = this.config.getRequestUrl(AptosApiType.FULLNODE);
|
|
41
|
+
|
|
42
|
+
// Load the calling module into the builder.
|
|
43
|
+
await this.builder.load_module(nodeUrl, `${moduleAddress}::${moduleName}`);
|
|
44
|
+
|
|
45
|
+
// Load the calling type arguments into the loader.
|
|
46
|
+
if (input.typeArguments !== undefined) {
|
|
47
|
+
for (const typeTag of input.typeArguments) {
|
|
48
|
+
// eslint-disable-next-line no-await-in-loop
|
|
49
|
+
await this.builder.load_type_tag(nodeUrl, typeTag.toString());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const typeArguments = standardizeTypeTags(input.typeArguments);
|
|
53
|
+
const functionAbi = await fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, this.config);
|
|
54
|
+
// Check the type argument count against the ABI
|
|
55
|
+
if (typeArguments.length !== functionAbi.typeParameters.length) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const functionArguments: CallArgument[] = input.functionArguments.map((arg, i) =>
|
|
62
|
+
convertCallArgument(arg, functionName, functionAbi, i, typeArguments),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return this.builder.add_batched_call(
|
|
66
|
+
`${moduleAddress}::${moduleName}`,
|
|
67
|
+
functionName,
|
|
68
|
+
typeArguments.map((arg) => arg.toString()),
|
|
69
|
+
functionArguments,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
build(): Uint8Array {
|
|
74
|
+
return this.builder.generate_batched_calls(true);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
throwTypeMismatch,
|
|
46
46
|
convertNumber,
|
|
47
47
|
} from "./helpers";
|
|
48
|
-
import { MoveFunction } from "../../types";
|
|
48
|
+
import { CallArgument, MoveFunction } from "../../types";
|
|
49
49
|
|
|
50
50
|
const TEXT_ENCODER = new TextEncoder();
|
|
51
51
|
|
|
@@ -92,6 +92,34 @@ export async function fetchFunctionAbi(
|
|
|
92
92
|
return undefined;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.
|
|
97
|
+
* @param moduleAddress
|
|
98
|
+
* @param moduleName
|
|
99
|
+
* @param functionName
|
|
100
|
+
* @param aptosConfig
|
|
101
|
+
*/
|
|
102
|
+
export async function fetchMoveFunctionAbi(
|
|
103
|
+
moduleAddress: string,
|
|
104
|
+
moduleName: string,
|
|
105
|
+
functionName: string,
|
|
106
|
+
aptosConfig: AptosConfig,
|
|
107
|
+
): Promise<FunctionABI> {
|
|
108
|
+
const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
|
|
109
|
+
if (!functionAbi) {
|
|
110
|
+
throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
|
|
111
|
+
}
|
|
112
|
+
const params: TypeTag[] = [];
|
|
113
|
+
for (let i = 0; i < functionAbi.params.length; i += 1) {
|
|
114
|
+
params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
typeParameters: functionAbi.generic_type_params,
|
|
119
|
+
parameters: params,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
95
123
|
/**
|
|
96
124
|
* Fetches the ABI for an entry function from the specified module address.
|
|
97
125
|
* This function validates if the ABI corresponds to an entry function and retrieves its parameters.
|
|
@@ -183,6 +211,32 @@ export async function fetchViewFunctionAbi(
|
|
|
183
211
|
};
|
|
184
212
|
}
|
|
185
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Converts a entry function argument into CallArgument, if necessary.
|
|
216
|
+
* This function checks the provided argument against the expected parameter type and converts it accordingly.
|
|
217
|
+
*
|
|
218
|
+
* @param functionName - The name of the function for which the argument is being converted.
|
|
219
|
+
* @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.
|
|
220
|
+
* @param argument - The argument to be converted, which can be of various types. If the argument is already
|
|
221
|
+
* CallArgument returned from TransactionComposer it would be returned immediately.
|
|
222
|
+
* @param position - The index of the argument in the function's parameter list.
|
|
223
|
+
* @param genericTypeParams - An array of type tags for any generic type parameters.
|
|
224
|
+
*/
|
|
225
|
+
export function convertCallArgument(
|
|
226
|
+
argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,
|
|
227
|
+
functionName: string,
|
|
228
|
+
functionAbi: FunctionABI,
|
|
229
|
+
position: number,
|
|
230
|
+
genericTypeParams: Array<TypeTag>,
|
|
231
|
+
): CallArgument {
|
|
232
|
+
if (argument instanceof CallArgument) {
|
|
233
|
+
return argument;
|
|
234
|
+
}
|
|
235
|
+
return CallArgument.new_bytes(
|
|
236
|
+
convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
186
240
|
/**
|
|
187
241
|
* Converts a non-BCS encoded argument into BCS encoded, if necessary.
|
|
188
242
|
* This function checks the provided argument against the expected parameter type and converts it accordingly.
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
AccountAuthenticator,
|
|
31
31
|
AccountAuthenticatorEd25519,
|
|
32
32
|
AccountAuthenticatorMultiKey,
|
|
33
|
+
AccountAuthenticatorNoAccountAuthenticator,
|
|
33
34
|
AccountAuthenticatorSingleKey,
|
|
34
35
|
} from "../authenticator/account";
|
|
35
36
|
import {
|
|
@@ -479,15 +480,16 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
479
480
|
transaction.feePayerAddress,
|
|
480
481
|
);
|
|
481
482
|
let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
|
|
482
|
-
if (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
483
|
+
if (transaction.secondarySignerAddresses) {
|
|
484
|
+
if (secondarySignersPublicKeys) {
|
|
485
|
+
secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
|
|
486
|
+
getAuthenticatorForSimulation(publicKey),
|
|
487
|
+
);
|
|
488
|
+
} else {
|
|
489
|
+
secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
|
|
490
|
+
getAuthenticatorForSimulation(undefined),
|
|
491
|
+
);
|
|
492
|
+
}
|
|
491
493
|
}
|
|
492
494
|
const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);
|
|
493
495
|
|
|
@@ -512,16 +514,16 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
512
514
|
|
|
513
515
|
let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
|
|
514
516
|
|
|
515
|
-
if (
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
if (secondarySignersPublicKeys) {
|
|
518
|
+
secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
|
|
519
|
+
getAuthenticatorForSimulation(publicKey),
|
|
520
|
+
);
|
|
521
|
+
} else {
|
|
522
|
+
secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
|
|
523
|
+
getAuthenticatorForSimulation(undefined),
|
|
518
524
|
);
|
|
519
525
|
}
|
|
520
526
|
|
|
521
|
-
secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
|
|
522
|
-
getAuthenticatorForSimulation(publicKey),
|
|
523
|
-
);
|
|
524
|
-
|
|
525
527
|
const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(
|
|
526
528
|
accountAuthenticator,
|
|
527
529
|
transaction.secondarySignerAddresses,
|
|
@@ -543,13 +545,19 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
543
545
|
accountAuthenticator instanceof AccountAuthenticatorMultiKey
|
|
544
546
|
) {
|
|
545
547
|
transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
|
|
548
|
+
} else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {
|
|
549
|
+
transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
|
|
546
550
|
} else {
|
|
547
551
|
throw new Error("Invalid public key");
|
|
548
552
|
}
|
|
549
553
|
return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();
|
|
550
554
|
}
|
|
551
555
|
|
|
552
|
-
export function getAuthenticatorForSimulation(publicKey
|
|
556
|
+
export function getAuthenticatorForSimulation(publicKey?: PublicKey) {
|
|
557
|
+
if (!publicKey) {
|
|
558
|
+
return new AccountAuthenticatorNoAccountAuthenticator();
|
|
559
|
+
}
|
|
560
|
+
|
|
553
561
|
// Wrap the public key types below with AnyPublicKey as they are only support through single sender.
|
|
554
562
|
// Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md
|
|
555
563
|
const convertToAnyPublicKey =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { CallArgument } from "@aptos-labs/script-composer-pack";
|
|
4
5
|
import { AptosConfig } from "../api/aptosConfig";
|
|
5
6
|
import { MoveOption, MoveString, MoveVector } from "../bcs/serializable/moveStructs";
|
|
6
7
|
import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
|
|
@@ -164,6 +165,16 @@ export type InputMultiSigDataWithABI = {
|
|
|
164
165
|
* Combines input function data with Aptos configuration for remote ABI interactions.
|
|
165
166
|
*/
|
|
166
167
|
export type InputEntryFunctionDataWithRemoteABI = InputEntryFunctionData & { aptosConfig: AptosConfig };
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The data needed to generate a batched function payload
|
|
171
|
+
*/
|
|
172
|
+
export type InputBatchedFunctionData = {
|
|
173
|
+
function: MoveFunctionId;
|
|
174
|
+
typeArguments?: Array<TypeArgument>;
|
|
175
|
+
functionArguments: Array<EntryFunctionArgumentTypes | CallArgument | SimpleEntryFunctionArgumentTypes>;
|
|
176
|
+
};
|
|
177
|
+
|
|
167
178
|
/**
|
|
168
179
|
* The data needed to generate a Multi Sig payload
|
|
169
180
|
*/
|
|
@@ -307,12 +318,13 @@ export type InputSimulateTransactionData = {
|
|
|
307
318
|
transaction: AnyRawTransaction;
|
|
308
319
|
/**
|
|
309
320
|
* For a single signer transaction
|
|
321
|
+
* This is optional and can be undefined to skip the public/auth key check during the transaction simulation.
|
|
310
322
|
*/
|
|
311
|
-
signerPublicKey
|
|
323
|
+
signerPublicKey?: PublicKey;
|
|
312
324
|
/**
|
|
313
325
|
* For a fee payer or multi-agent transaction that requires additional signers in
|
|
314
326
|
*/
|
|
315
|
-
secondarySignersPublicKeys?: Array<PublicKey>;
|
|
327
|
+
secondarySignersPublicKeys?: Array<PublicKey | undefined>;
|
|
316
328
|
/**
|
|
317
329
|
* For a fee payer transaction (aka Sponsored Transaction)
|
|
318
330
|
*/
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as h,c as sn,d as cn,e as R}from"./chunk-KTM6KVUJ.mjs";import{r as on,u as A}from"./chunk-5O3RHPER.mjs";import{a as an}from"./chunk-FYYTCJS4.mjs";import{b as rn}from"./chunk-I5GENJBA.mjs";import{a as en}from"./chunk-HPZQGMSH.mjs";import{a as tn}from"./chunk-4IQZOAN7.mjs";import{a as y}from"./chunk-LYO22HMF.mjs";import{a as nn}from"./chunk-O4MRRWRI.mjs";import{a as J,c as Q,d as Y}from"./chunk-D54FD6XE.mjs";import{c as H,d as X,e as z,f as x,g as L,h as Z,i as j}from"./chunk-A3USS2NC.mjs";import{b as B,d as F,e as D,f as M}from"./chunk-KX43GEAB.mjs";import{a as V,b as p,d as l,e as E}from"./chunk-DYELAVMR.mjs";import{a as q}from"./chunk-OPO5EYF7.mjs";import{a as k,b as O}from"./chunk-OVI7L7OG.mjs";import{a as b,b as g}from"./chunk-P2FTRAK3.mjs";import{a as N}from"./chunk-YIQ3JFHW.mjs";import{a as v}from"./chunk-IQ4SCMB6.mjs";import{i as S,j as C}from"./chunk-K62JTXWQ.mjs";import{b as $,d as K}from"./chunk-VGJIATTB.mjs";import{b as u}from"./chunk-JNO7KPMG.mjs";import{a as _}from"./chunk-HBIDHQ2M.mjs";import{a as U}from"./chunk-UZTJWOLS.mjs";import{g as I}from"./chunk-D3OEQLUE.mjs";import{b as W,c as G}from"./chunk-J7PJSK3J.mjs";import{b as P}from"./chunk-SPRNSFUV.mjs";import{sha3_256 as fn}from"@noble/hashes/sha3";async function qn(n){if(on(n))return ln(n);let{moduleAddress:e,moduleName:t,functionName:i}=A(n.function),a=await dn({key:"entry-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:sn});return gn({...n,abi:a})}function gn(n){let e=n.abi,{moduleAddress:t,moduleName:i,functionName:a}=A(n.function),r=h(n.typeArguments);if(r.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${r.length}`);let o=n.functionArguments.map((s,d)=>R(n.function,e,s,d,r));if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${a}', expected ${e.parameters.length} but got ${o.length}`);let c=x.build(`${t}::${i}`,a,r,o);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new z(new Z(s,new j(c)))}return new X(c)}async function Hn(n){let{moduleAddress:e,moduleName:t,functionName:i}=A(n.function),a=await dn({key:"view-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:cn});return pn({abi:a,...n})}function pn(n){let e=n.abi,{moduleAddress:t,moduleName:i,functionName:a}=A(n.function),r=h(n.typeArguments);if(r.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${r.length}`);let o=n?.functionArguments?.map((c,s)=>R(n.function,e,c,s,r))??[];if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${a}', expected ${e.parameters.length} but got ${o.length}`);return x.build(`${t}::${i}`,a,r,o)}function ln(n){return new H(new L(P.fromHexInput(n.bytecode).toUint8Array(),h(n.typeArguments),n.functionArguments))}async function hn(n){let{aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r}=n,o=async()=>I[e.network]?{chainId:I[e.network]}:{chainId:(await en({aptosConfig:e})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await rn({aptosConfig:e})).gas_estimate},s=async()=>{let f=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:(await an({aptosConfig:e,accountAddress:t})).sequence_number;if(r&&u.from(r).equals(u.ZERO))try{return await f()}catch{return 0}else return f()},[{chainId:d},{gasEstimate:m},w]=await Promise.all([o(),c(),s()]),{maxGasAmount:mn,gasUnitPrice:yn,expireTimestamp:An}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(2e5),gasUnitPrice:a?.gasUnitPrice??BigInt(m),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new J(u.from(t),BigInt(w),i,BigInt(mn),BigInt(yn),BigInt(An),new q(d))}async function Xn(n){let{aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r}=n,o=await hn({aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new tn(o,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new nn(o,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function zn(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:i,feePayerPublicKey:a}=n,r=T(e);if(t.feePayerAddress){let c=new Y(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];if(i&&(s=i.map(w=>T(w))),!a)throw new Error("Must provide a feePayerPublicKey argument to generate a signed fee payer transaction for simulation");let d=T(a),m=new D(r,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new y(c.raw_txn,m).bcsToBytes()}if(t.secondarySignerAddresses){let c=new Q(t.rawTransaction,t.secondarySignerAddresses),s=[];if(!i)throw new Error("Must provide a secondarySignersPublicKeys argument to generate a signed multi agent transaction for simulation");s=i.map(m=>T(m));let d=new F(r,t.secondarySignerAddresses,s);return new y(c.raw_txn,d).bcsToBytes()}let o;if(r instanceof p)o=new B(r.public_key,r.signature);else if(r instanceof l||r instanceof E)o=new M(r);else throw new Error("Invalid public key");return new y(t.rawTransaction,o).bcsToBytes()}function T(n){let t=S.isInstance(n)||v.isInstance(n)||N.isInstance(n)?new b(n):n,i=new K(new Uint8Array(64));if($.isInstance(t))return new p(t,i);if(b.isInstance(t))return S.isInstance(t.publicKey)?new l(t,new g(C.getSimulationSignature())):new l(t,new g(i));if(k.isInstance(t))return new E(t,new O({signatures:t.publicKeys.map(()=>new g(i)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((a,r)=>r)})}));throw new Error("Unsupported PublicKey used for simulations")}function Tn(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:i}=n,a=U(V,n.senderAuthenticator),r;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new D(a,e.secondarySignerAddresses??[],i??[],{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new F(a,e.secondarySignerAddresses,i)}else a instanceof p?r=new B(a.public_key,a.signature):r=new M(a);return new y(e.rawTransaction,r).bcsToBytes()}function un(n){let e=fn.create();for(let t of n)e.update(t);return e.digest()}var wn=un(["APTOS::Transaction"]);function Ln(n){let e=Tn(n);return new P(un([wn,new Uint8Array([0]),e])).toString()}async function dn({key:n,moduleAddress:e,moduleName:t,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:_(async()=>o(e,t,i,a),`${n}-${a.network}-${e}-${t}-${i}`,1e3*60*5)()}export{qn as a,gn as b,Hn as c,pn as d,hn as e,Xn as f,zn as g,T as h,Tn as i,un as j,Ln as k};
|
|
2
|
-
//# sourceMappingURL=chunk-26WX3UFP.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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/account\";\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 AccountAuthenticatorMultiKey,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticator,\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\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 { getFunctionParts, isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\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 */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\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 */\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 */\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\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 */\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 */\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 */\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 */\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 */\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 */\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 */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\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 */\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 */\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 (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n if (!feePayerPublicKey) {\n throw new Error(\n \"Must provide a feePayerPublicKey argument to generate a signed fee payer transaction for simulation\",\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 throw new Error(\n \"Must provide a secondarySignersPublicKeys argument to generate a signed multi agent transaction for simulation\",\n );\n }\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\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 {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\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(() => new AnySignature(invalidSignature)),\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 */\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 {\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 */\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 */\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 */\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 */\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":"0qCAQA,OAAS,YAAYA,OAAgB,qBA2GrC,eAAsBC,GACpBC,EACwC,CACxC,GA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7C,IAAAoG,EACA,cAAAzG,EACA,WAAAC,EACA,aAAAC,EACA,YAAA2B,EACA,IAAA6E,EACA,MAAAC,CACF,EAQe,CACb,OAAID,IAAQ,OACHA,EAIFE,EACL,SAAYD,EAAM3G,EAAeC,EAAYC,EAAc2B,CAAW,EACtE,GAAG4E,CAAG,IAAI5E,EAAY,OAAO,IAAI7B,CAAa,IAAIC,CAAU,IAAIC,CAAY,GAC5E,IAAO,GAAK,CACd,EAAE,CACJ","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","fetchAbi","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultiSig","MultiSig","MultiSigTransactionPayload","TransactionPayloadEntryFunction","generateViewFunctionPayload","fetchViewFunctionAbi","generateViewFunctionPayloadWithABI","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","getSequenceNumberForAny","getSequenceNumber","getInfo","chainId","gasEstimate","sequenceNumber","maxGasAmount","gasUnitPrice","expireTimestamp","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","MultiAgentTransaction","SimpleTransaction","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","TransactionAuthenticatorSingleSender","accountPublicKey","KeylessPublicKey","FederatedKeylessPublicKey","Secp256k1PublicKey","AnyPublicKey","invalidSignature","Ed25519Signature","Ed25519PublicKey","AnySignature","KeylessSignature","MultiKey","MultiKeySignature","_","generateSignedTransaction","additionalSignersAuthenticators","senderAuthenticator","normalizeBundle","AccountAuthenticator","txnAuthenticator","hashValues","input","hash","sha3Hash","item","TRANSACTION_PREFIX","generateUserTransactionHash","signedTransaction","key","abi","fetch","memoizeAsync"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{spawn as p}from"child_process";import{platform as m}from"os";var u=class{async init(e){let{network:o,profile:t,extraArguments:r,showStdout:a}=e,s=["aptos","init",`--network=${o??"local"}`,`--profile=${t??"default"}`];return r&&s.push(...r),this.runCommand(s,a)}async compile(e){let{packageDirectoryPath:o,namedAddresses:t,extraArguments:r,showStdout:a}=e,s=["aptos","move","compile","--package-dir",o],d=this.parseNamedAddresses(t);return s.push(...this.prepareNamedAddresses(d)),r&&s.push(...r),this.runCommand(s,a)}async test(e){let{packageDirectoryPath:o,namedAddresses:t,extraArguments:r,showStdout:a}=e,s=["aptos","move","test","--package-dir",o],d=this.parseNamedAddresses(t);return s.push(...this.prepareNamedAddresses(d)),r&&s.push(...r),this.runCommand(s,a)}async publish(e){let{packageDirectoryPath:o,namedAddresses:t,profile:r,extraArguments:a,showStdout:s}=e,d=["aptos","move","publish","--package-dir",o,`--profile=${r??"default"}`],n=this.parseNamedAddresses(t);return d.push(...this.prepareNamedAddresses(n)),a&&d.push(...a),this.runCommand(d,s)}async createObjectAndPublishPackage(e){let{packageDirectoryPath:o,addressName:t,namedAddresses:r,profile:a,extraArguments:s,showStdout:d}=e,n=["aptos","move","create-object-and-publish-package","--package-dir",o,"--address-name",t,`--profile=${a??"default"}`],i=this.parseNamedAddresses(r);n.push(...this.prepareNamedAddresses(i)),s&&n.push(...s);let{output:c}=await this.runCommand(n,d);return{objectAddress:this.extractAddressFromOutput(c)}}async upgradeObjectPackage(e){let{packageDirectoryPath:o,objectAddress:t,namedAddresses:r,profile:a,extraArguments:s,showStdout:d}=e,n=["aptos","move","upgrade-object-package","--package-dir",o,"--object-address",t,`--profile=${a??"default"}`],i=this.parseNamedAddresses(r);return n.push(...this.prepareNamedAddresses(i)),s&&n.push(...s),this.runCommand(n,d)}async buildPublishPayload(e){let{outputFile:o,packageDirectoryPath:t,namedAddresses:r,extraArguments:a,showStdout:s}=e,d=["aptos","move","build-publish-payload","--json-output-file",o,"--package-dir",t],n=this.parseNamedAddresses(r);return d.push(...this.prepareNamedAddresses(n)),a&&d.push(...a),this.runCommand(d,s)}async runScript(e){let{compiledScriptPath:o,profile:t,extraArguments:r,showStdout:a}=e,s=["aptos","move","run-script","--compiled-script-path",o,`--profile=${t??"default"}`];return r&&s.push(...r),this.runCommand(s,a)}async runCommand(e,o=!0){return new Promise((t,r)=>{let a=m(),s,d="",n="";a==="win32"?s=p("npx",e,{shell:!0}):s=p("npx",e),s.stdout.on("data",i=>{n=i.toString(),d+=i.toString()}),o&&(s.stdout.pipe(process.stdout),s.stderr.pipe(process.stderr)),process.stdin.pipe(s.stdin),s.on("close",i=>{if(i===0)try{let c=JSON.parse(n);c.Error?r(new Error(`Error: ${c.Error}`)):c.Result&&t({result:c.Result,output:d})}catch{t({output:d})}else r(new Error(`Child process exited with code ${i}`))})})}prepareNamedAddresses(e){let o=e.size,t=[];if(o===0)return t;t.push("--named-addresses");let r=[];return e.forEach((a,s)=>{let d=`${s}=${a.toString()}`;r.push(d)}),t.push(r.join(",")),t}parseNamedAddresses(e){let o=new Map;return Object.keys(e).forEach(t=>{let r=e[t];o.set(t,r)}),o}extractAddressFromOutput(e){let o=e.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");if(o)return o[1];throw new Error("Failed to extract object address from output")}};export{u as a};
|
|
2
|
-
//# sourceMappingURL=chunk-AITN3DO4.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d,b}from"./chunk-2YTHKFJZ.mjs";import{a as h,b as z}from"./chunk-OVI7L7OG.mjs";import{a as p,b as g}from"./chunk-P2FTRAK3.mjs";import{b as o,d as y}from"./chunk-VGJIATTB.mjs";import{a as c}from"./chunk-AJ5JHBAE.mjs";var r=class extends c{static deserialize(i){let e=i.deserializeUleb128AsU32();switch(e){case 0:return u.load(i);case 1:return l.load(i);case 2:return n.load(i);case 3:return a.load(i);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof u}isMultiEd25519(){return this instanceof l}isSingleKey(){return this instanceof n}isMultiKey(){return this instanceof a}},u=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(0),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=o.deserialize(i),s=y.deserialize(i);return new t(e,s)}},l=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(1),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=d.deserialize(i),s=b.deserialize(i);return new t(e,s)}},n=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(2),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=p.deserialize(i),s=g.deserialize(i);return new t(e,s)}},a=class t extends r{constructor(i,e){super(),this.public_keys=i,this.signatures=e}serialize(i){i.serializeU32AsUleb128(3),this.public_keys.serialize(i),this.signatures.serialize(i)}static load(i){let e=h.deserialize(i),s=z.deserialize(i);return new t(e,s)}};export{r as a,u as b,l as c,n as d,a as e};
|
|
2
|
-
//# sourceMappingURL=chunk-DYELAVMR.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/authenticator/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Serializer, Deserializer, Serializable } from \"../../bcs\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { MultiKey, MultiKeySignature } from \"../../core/crypto/multiKey\";\nimport { AccountAuthenticatorVariant } from \"../../types\";\n\n/**\n * Represents an account authenticator that can handle multiple authentication variants.\n * This class serves as a base for different types of account authenticators, allowing for serialization\n * and deserialization of various authenticator types.\n *\n * @extends Serializable\n */\nexport abstract class AccountAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserializes an AccountAuthenticator from the provided deserializer.\n * This function helps in reconstructing the AccountAuthenticator object based on the variant index.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): AccountAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AccountAuthenticatorVariant.Ed25519:\n return AccountAuthenticatorEd25519.load(deserializer);\n case AccountAuthenticatorVariant.MultiEd25519:\n return AccountAuthenticatorMultiEd25519.load(deserializer);\n case AccountAuthenticatorVariant.SingleKey:\n return AccountAuthenticatorSingleKey.load(deserializer);\n case AccountAuthenticatorVariant.MultiKey:\n return AccountAuthenticatorMultiKey.load(deserializer);\n default:\n throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);\n }\n }\n\n /**\n * Determines if the current instance is an Ed25519 account authenticator.\n *\n * @returns {boolean} True if the instance is of type AccountAuthenticatorEd25519, otherwise false.\n */\n isEd25519(): this is AccountAuthenticatorEd25519 {\n return this instanceof AccountAuthenticatorEd25519;\n }\n\n /**\n * Determines if the current instance is of type AccountAuthenticatorMultiEd25519.\n *\n * @returns {boolean} True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.\n */\n isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {\n return this instanceof AccountAuthenticatorMultiEd25519;\n }\n\n /**\n * Determines if the current instance is of the type AccountAuthenticatorSingleKey.\n *\n * @returns {boolean} True if the instance is an AccountAuthenticatorSingleKey, otherwise false.\n */\n isSingleKey(): this is AccountAuthenticatorSingleKey {\n return this instanceof AccountAuthenticatorSingleKey;\n }\n\n /**\n * Determine if the current instance is of type AccountAuthenticatorMultiKey.\n *\n * @returns {boolean} Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.\n */\n isMultiKey(): this is AccountAuthenticatorMultiKey {\n return this instanceof AccountAuthenticatorMultiKey;\n }\n}\n\n/**\n * Represents an Ed25519 transaction authenticator for multi-signer transactions.\n * This class encapsulates the account's Ed25519 public key and signature.\n *\n * @param public_key - The Ed25519 public key associated with the account.\n * @param signature - The Ed25519 signature for the account.\n */\nexport class AccountAuthenticatorEd25519 extends AccountAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n /**\n * Creates an instance of the class with the specified public keys and signatures.\n *\n * @param public_key The public key used for verification.\n * @param signature The signatures corresponding to the public keys.\n */\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n /**\n * Serializes the account authenticator data into the provided serializer.\n * This function captures the multi-key variant, public keys, and signatures for serialization.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n /**\n * Loads an instance of AccountAuthenticatorMultiKey from the provided deserializer.\n * This function helps in reconstructing the authenticator object using the deserialized public keys and signatures.\n *\n * @param deserializer - The deserializer used to extract the necessary data for loading the authenticator.\n */\n static load(deserializer: Deserializer): AccountAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents a transaction authenticator for Multi Ed25519, designed for multi-signer transactions.\n *\n * @param public_key - The MultiEd25519 public key of the account.\n * @param signature - The MultiEd25519 signature of the account.\n */\nexport class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that utilizes a single key for signing.\n * This class is designed to handle authentication using a public key and its corresponding signature.\n *\n * @param public_key - The public key used for authentication.\n * @param signature - The signature associated with the public key.\n */\nexport class AccountAuthenticatorSingleKey extends AccountAuthenticator {\n public readonly public_key: AnyPublicKey;\n\n public readonly signature: AnySignature;\n\n constructor(public_key: AnyPublicKey, signature: AnySignature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.SingleKey);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorSingleKey {\n const public_key = AnyPublicKey.deserialize(deserializer);\n const signature = AnySignature.deserialize(deserializer);\n return new AccountAuthenticatorSingleKey(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that supports multiple keys and signatures for multi-signature scenarios.\n *\n * @param public_keys - The public keys used for authentication.\n * @param signatures - The signatures corresponding to the public keys.\n */\nexport class AccountAuthenticatorMultiKey extends AccountAuthenticator {\n public readonly public_keys: MultiKey;\n\n public readonly signatures: MultiKeySignature;\n\n constructor(public_keys: MultiKey, signatures: MultiKeySignature) {\n super();\n this.public_keys = public_keys;\n this.signatures = signatures;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);\n this.public_keys.serialize(serializer);\n this.signatures.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {\n const public_keys = MultiKey.deserialize(deserializer);\n const signatures = MultiKeySignature.deserialize(deserializer);\n return new AccountAuthenticatorMultiKey(public_keys, signatures);\n }\n}\n"],"mappings":"oOAmBO,IAAeA,EAAf,cAA4CC,CAAa,CAS9D,OAAO,YAAYC,EAAkD,CACnE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAA4B,KAAKF,CAAY,EACtD,OACE,OAAOG,EAAiC,KAAKH,CAAY,EAC3D,OACE,OAAOI,EAA8B,KAAKJ,CAAY,EACxD,OACE,OAAOK,EAA6B,KAAKL,CAAY,EACvD,QACE,MAAM,IAAI,MAAM,mDAAmDC,CAAK,EAAE,CAC9E,CACF,CAOA,WAAiD,CAC/C,OAAO,gBAAgBC,CACzB,CAOA,gBAA2D,CACzD,OAAO,gBAAgBC,CACzB,CAOA,aAAqD,CACnD,OAAO,gBAAgBC,CACzB,CAOA,YAAmD,CACjD,OAAO,gBAAgBC,CACzB,CACF,EASaH,EAAN,MAAMI,UAAoCR,CAAqB,CAWpE,YAAYS,EAA8BC,EAA6B,CACrE,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAQA,UAAUC,EAA8B,CACtCA,EAAW,uBAAyD,EACpE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAQA,OAAO,KAAKT,EAAyD,CACnE,IAAMO,EAAaG,EAAiB,YAAYV,CAAY,EACtDQ,EAAYG,EAAiB,YAAYX,CAAY,EAC3D,OAAO,IAAIM,EAA4BC,EAAYC,CAAS,CAC9D,CACF,EAQaL,EAAN,MAAMS,UAAyCd,CAAqB,CAKzE,YAAYS,EAAmCC,EAAkC,CAC/E,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA8D,EACzE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKT,EAA8D,CACxE,IAAMO,EAAaM,EAAsB,YAAYb,CAAY,EAC3DQ,EAAYM,EAAsB,YAAYd,CAAY,EAChE,OAAO,IAAIY,EAAiCL,EAAYC,CAAS,CACnE,CACF,EASaJ,EAAN,MAAMW,UAAsCjB,CAAqB,CAKtE,YAAYS,EAA0BC,EAAyB,CAC7D,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA2D,EACtE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKT,EAA2D,CACrE,IAAMO,EAAaS,EAAa,YAAYhB,CAAY,EAClDQ,EAAYS,EAAa,YAAYjB,CAAY,EACvD,OAAO,IAAIe,EAA8BR,EAAYC,CAAS,CAChE,CACF,EAQaH,EAAN,MAAMa,UAAqCpB,CAAqB,CAKrE,YAAYqB,EAAuBC,EAA+B,CAChE,MAAM,EACN,KAAK,YAAcD,EACnB,KAAK,WAAaC,CACpB,CAEA,UAAUX,EAA8B,CACtCA,EAAW,uBAA0D,EACrE,KAAK,YAAY,UAAUA,CAAU,EACrC,KAAK,WAAW,UAAUA,CAAU,CACtC,CAEA,OAAO,KAAKT,EAA0D,CACpE,IAAMmB,EAAcE,EAAS,YAAYrB,CAAY,EAC/CoB,EAAaE,EAAkB,YAAYtB,CAAY,EAC7D,OAAO,IAAIkB,EAA6BC,EAAaC,CAAU,CACjE,CACF","names":["AccountAuthenticator","Serializable","deserializer","index","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","_AccountAuthenticatorEd25519","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","_AccountAuthenticatorMultiEd25519","MultiEd25519PublicKey","MultiEd25519Signature","_AccountAuthenticatorSingleKey","AnyPublicKey","AnySignature","_AccountAuthenticatorMultiKey","public_keys","signatures","MultiKey","MultiKeySignature"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-FD6FGKYY.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function o(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,t)},e}function u(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,t)},e}export{o as a,u as b};
|
|
2
|
-
//# sourceMappingURL=chunk-I2NMCLNW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-I5OYNCZS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/transactionSubmission/simulate.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey } from \"../../core\";\nimport { simulateTransaction } from \"../../internal/transactionSubmission\";\nimport { AnyRawTransaction, InputSimulateTransactionOptions } from \"../../transactions\";\nimport { UserTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSimulation } from \"./helpers\";\n\n/**\n * A class to handle all `Simulate` transaction operations.\n */\nexport class Simulate {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you 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({ network: Network.TESTNET }); // Specify your desired network\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 */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Simulates a transaction based on the provided parameters and returns the result.\n * This function helps you understand the outcome of a transaction before executing it on the blockchain.\n *\n * @param args - The parameters for simulating the transaction.\n * @param args.signerPublicKey - The public key of the signer for the transaction.\n * @param args.transaction - The raw transaction data to simulate.\n * @param args.feePayerPublicKey - The public key of the fee payer (optional).\n * @param args.options - Additional options for simulating the transaction (optional).\n *\n * @example\n * ```typescript\n * import {\n * Account,\n * Aptos,\n * AptosConfig,\n * Network,\n * } from \"@aptos-labs/ts-sdk\";\n *\n * async function example() {\n * let sender = Account.generate();\n * let receiver = Account.generate();\n *\n * // 0. Set up the client and test accounts\n * const config = new AptosConfig({ network: Network.DEVNET });\n * const aptos = new Aptos(config);\n *\n * await aptos.fundAccount({\n * accountAddress: sender.accountAddress,\n * amount: 100_000_000,\n * });\n *\n * // 1. Build the transaction to preview the impact of it\n * const transaction = await aptos.transaction.build.simple({\n * sender: sender.accountAddress,\n * data: {\n * // All transactions on Aptos are implemented via smart contracts.\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [receiver.accountAddress, 100],\n * },\n * });\n *\n * // 2. Simulate to see what would happen if we execute this transaction\n * const [userTransactionResponse] = await aptos.transaction.simulate.simple({\n * signerPublicKey: sender.publicKey,\n * transaction,\n * });\n * console.log(userTransactionResponse);\n *\n * // If the fee looks ok, continue to signing!\n * // ...\n * }\n *\n * example();\n * ```\n */\n @ValidateFeePayerDataOnSimulation\n async simple(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Simulates a multi-agent transaction by generating a signed transaction and posting it to the Aptos full node.\n * This function helps in understanding the outcome of a transaction involving multiple signers before it is executed.\n *\n * @param args - The parameters for simulating the transaction.\n * @param args.signerPublicKey - The public key of the primary signer.\n * @param args.transaction - The raw transaction to be simulated.\n * @param args.secondarySignersPublicKeys - An array of public keys for secondary signers.\n * @param args.feePayerPublicKey - (Optional) The public key of the fee payer.\n * @param args.options - (Optional) Options for simulating the transaction.\n *\n * @example\n * ```typescript\n * import {\n * Account,\n * Aptos,\n * AptosConfig,\n * Network,\n * } from \"@aptos-labs/ts-sdk\";\n *\n * async function example() {\n * let sender1 = Account.generate();\n * let sender2 = Account.generate();\n * let receiver = Account.generate();\n *\n * // 0. Set up the client and test accounts\n * const config = new AptosConfig({ network: Network.DEVNET });\n * const aptos = new Aptos(config);\n *\n * await aptos.fundAccount({\n * accountAddress: sender.accountAddress,\n * amount: 100_000_000,\n * });\n *\n * // 1. Build\n * console.log(\"\\n=== 1. Building the transaction ===\\n\");\n * const transaction = await aptos.transaction.build.multiAgent({\n * sender: sender1.accountAddress,\n * secondarySignerAddresses: [sender2.accountAddress],\n * data: {\n * // REPLACE WITH YOUR MULTI-AGENT FUNCTION HERE\n * function:\n * \"<REPLACE WITH YOUR MULTI AGENT MOVE ENTRY FUNCTION> (Syntax {address}::{module}::{function})\",\n * functionArguments: [],\n * },\n * });\n * console.log(\"Transaction:\", transaction);\n *\n * // 2. Simulate (Optional)\n * console.log(\"\\n === 2. Simulating Response (Optional) === \\n\");\n * const [userTransactionResponse] = await aptos.transaction.simulate.multiAgent(\n * {\n * signerPublicKey: sender1.publicKey,\n * secondarySignersPublicKeys: [sender2.publicKey],\n * transaction,\n * },\n * );\n * console.log(userTransactionResponse);\n *\n * // If the fee looks ok, continue to signing!\n * // ...\n * }\n *\n * example();\n * ```\n */\n @ValidateFeePayerDataOnSimulation\n async multiAgent(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n secondarySignersPublicKeys: Array<PublicKey>;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,KAAe,CA2BpB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CA2DA,MAAM,OAAOC,EAK+B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CAqEA,MAAM,WAAWA,EAM2B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF,EArFQE,EAAA,CADLC,GAvFUL,EAwFL,sBA4EAI,EAAA,CADLC,GAnKUL,EAoKL","names":["Simulate","config","args","simulateTransaction","__decorateClass","ValidateFeePayerDataOnSimulation"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as l}from"./chunk-AOROYJ74.mjs";import{a as k,b as c,d as A,e as g,f as P,g as z,h as D,i as m,j as L,l as R,m as X,n as q,o as H,p as J,q as K,s as i,t as Q}from"./chunk-5O3RHPER.mjs";import{c as j}from"./chunk-FYYTCJS4.mjs";import{b as S,c as I,d as x,e as M,f as O,g as C,h as _,i as V,n as G}from"./chunk-T6ADNZE5.mjs";import{b as d}from"./chunk-JNO7KPMG.mjs";import{a as y,c as F,d as s}from"./chunk-Q3CWUEXI.mjs";import{a as w,b as h,c as B,d as E,e as v,f as $,g as b}from"./chunk-42H7WETG.mjs";var Y=new TextEncoder;function sn(n){return n?.map(e=>c(e)?l(e):e)??[]}async function W(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(o=>o.name===t)}async function fn(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Q(r),T=[];for(let f=o;f<r.params.length;f+=1)T.push(l(r.params[f],{allowGenerics:!0}));return{signers:o,typeParameters:r.generic_type_params,parameters:T}}async function on(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let f=0;f<r.params.length;f+=1)o.push(l(r.params[f],{allowGenerics:!0}));let T=[];for(let f=0;f<r.return.length;f+=1)T.push(l(r.return[f],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:o,returnTypes:T}}function cn(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[u];return U(t,o,u,r)}function U(n,e,t,u){return z(n)?(p(e,n,t),n):Z(n,e,t,u)}function Z(n,e,t,u){if(e.isBool()){if(k(n))return new w(n);if(c(n)){if(n==="true")return new w(!0);if(n==="false")return new w(!1)}i("boolean",t)}if(e.isAddress()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=A(n);if(r!==void 0)return new h(r);i("number | string",t)}if(e.isU16()){let r=A(n);if(r!==void 0)return new B(r);i("number | string",t)}if(e.isU32()){let r=A(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU64()){if(g(n))return new v(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(g(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(g(n))return new b(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(c(n))return y.U8(Y.encode(n));if(n instanceof Uint8Array)return y.U8(n);if(n instanceof ArrayBuffer)return y.U8(new Uint8Array(n))}if(Array.isArray(n))return new y(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(c(n))return new F(n);i("string",t)}if(e.isObject()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(P(n)){let r=e.value.typeArgs[0];return r instanceof S?new s(null):r instanceof V?new s(null):r instanceof I?new s(null):r instanceof x?new s(null):r instanceof M?new s(null):r instanceof O?new s(null):r instanceof C?new s(null):r instanceof _?new s(null):new s(null)}return new s(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function p(n,e,t){if(n.isBool()){if(D(e))return;i("Bool",t)}if(n.isAddress()){if(m(e))return;i("AccountAddress",t)}if(n.isU8()){if(R(e))return;i("U8",t)}if(n.isU16()){if(X(e))return;i("U16",t)}if(n.isU32()){if(q(e))return;i("U32",t)}if(n.isU64()){if(H(e))return;i("U64",t)}if(n.isU128()){if(J(e))return;i("U128",t)}if(n.isU256()){if(K(e))return;i("U256",t)}if(n.isVector()){if(e instanceof y){e.values.length>0&&p(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof G){if(n.isString()){if(L(e))return;i("MoveString",t)}if(n.isObject()){if(m(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof s){e.value!==void 0&&p(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{sn as a,W as b,fn as c,on as d,cn as e,U as f};
|
|
2
|
-
//# sourceMappingURL=chunk-KTM6KVUJ.mjs.map
|