@aptos-labs/ts-sdk 1.32.0 → 1.32.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/chunk-F43XVDYJ.js.map +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +7 -103
- package/dist/common/index.js +31 -31
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +0 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +0 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +0 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +0 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +0 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +0 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +0 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +0 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +0 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +0 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +0 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +0 -2
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +0 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +2 -3
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +0 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +0 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +0 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +0 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +0 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +0 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +1 -2
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +0 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +0 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +0 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +0 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +0 -66
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +0 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +0 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +0 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +0 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +0 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.d.mts +0 -1
- package/dist/esm/bcs/deserializer.d.mts +0 -1
- package/dist/esm/bcs/index.d.mts +0 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +0 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +0 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +0 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +0 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +0 -1
- package/dist/esm/{chunk-XKOSS5KC.mjs → chunk-26WX3UFP.mjs} +2 -2
- package/dist/esm/{chunk-HEHVWRMO.mjs → chunk-2E3BT4YW.mjs} +2 -2
- package/dist/esm/{chunk-JLD7DLKM.mjs → chunk-2LQ4FTSR.mjs} +2 -2
- package/dist/esm/{chunk-E2NYQVP3.mjs → chunk-2REHS35S.mjs} +2 -2
- package/dist/esm/{chunk-QQM47PHZ.mjs → chunk-2YTHKFJZ.mjs} +2 -2
- package/dist/esm/{chunk-IBMZYDAR.mjs → chunk-4IQZOAN7.mjs} +2 -2
- package/dist/esm/{chunk-VCY3JGZM.mjs → chunk-4J2JYRV3.mjs} +2 -2
- package/dist/esm/{chunk-5AKSORBJ.mjs → chunk-5KCKWL2C.mjs} +2 -2
- package/dist/esm/{chunk-WSFHH3BK.mjs → chunk-5O3RHPER.mjs} +2 -2
- package/dist/esm/{chunk-AAATWCJT.mjs → chunk-7OHMMGS6.mjs} +2 -2
- package/dist/esm/{chunk-L2QVUMBV.mjs → chunk-A3USS2NC.mjs} +2 -2
- package/dist/esm/{chunk-DP3YPGIK.mjs → chunk-AGEJNSEX.mjs} +2 -2
- package/dist/esm/{chunk-XT5T5LAP.mjs → chunk-BP45UJII.mjs} +2 -2
- package/dist/esm/{chunk-SU2WB34N.mjs → chunk-CEW2NI3K.mjs} +2 -2
- package/dist/esm/{chunk-6LLGRGCN.mjs → chunk-CPKG25HX.mjs} +2 -2
- package/dist/esm/{chunk-X3JPX7T6.mjs → chunk-D54FD6XE.mjs} +2 -2
- package/dist/esm/{chunk-YZ3YPLEU.mjs → chunk-DYELAVMR.mjs} +2 -2
- package/dist/esm/{chunk-2QBCTW67.mjs → chunk-E2GPZCQI.mjs} +2 -2
- package/dist/esm/{chunk-7WXDXBXK.mjs → chunk-EJKX6MGV.mjs} +2 -2
- package/dist/esm/{chunk-HXXELLHN.mjs → chunk-ERDYU5YQ.mjs} +2 -2
- package/dist/esm/{chunk-CA3Q2X6B.mjs → chunk-ETF76XA3.mjs} +2 -2
- package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
- package/dist/esm/{chunk-OKE3FXIP.mjs → chunk-FFCCBAEZ.mjs} +2 -2
- package/dist/esm/{chunk-K4TJRYGQ.mjs → chunk-FYYTCJS4.mjs} +2 -2
- package/dist/esm/{chunk-3XCYCFYI.mjs → chunk-GX4CYRK4.mjs} +2 -2
- package/dist/esm/{chunk-5NJWJXSS.mjs → chunk-GZBVXXUL.mjs} +2 -2
- package/dist/esm/{chunk-IDNDUJOK.mjs → chunk-H7AALSJ7.mjs} +2 -2
- package/dist/esm/{chunk-SBCLBDCP.mjs → chunk-HBWIDPNN.mjs} +2 -2
- package/dist/esm/{chunk-PW3ISXPN.mjs → chunk-HPZQGMSH.mjs} +2 -2
- package/dist/esm/{chunk-OJBMR5CT.mjs → chunk-I5GENJBA.mjs} +2 -2
- package/dist/esm/chunk-I5OYNCZS.mjs +1 -0
- package/dist/esm/{chunk-JJUINAQE.mjs → chunk-II26BNYA.mjs} +2 -2
- package/dist/esm/{chunk-YPBNYKOD.mjs → chunk-IQ4SCMB6.mjs} +2 -2
- package/dist/esm/{chunk-4YEOOZ2N.mjs → chunk-IUSAYAEI.mjs} +2 -2
- package/dist/esm/{chunk-J245N3XF.mjs → chunk-J7PJSK3J.mjs} +2 -2
- package/dist/esm/{chunk-J245N3XF.mjs.map → chunk-J7PJSK3J.mjs.map} +1 -1
- package/dist/esm/{chunk-6K4TOFCO.mjs → chunk-JGLEKXFP.mjs} +2 -2
- package/dist/esm/{chunk-DDVOBEJA.mjs → chunk-JIT2FYGE.mjs} +2 -2
- package/dist/esm/{chunk-46L6BAJG.mjs → chunk-JONEH52T.mjs} +2 -2
- package/dist/esm/{chunk-XUP6VABV.mjs → chunk-K62JTXWQ.mjs} +2 -2
- package/dist/esm/{chunk-6PJH53CK.mjs → chunk-KCEI5JYS.mjs} +2 -2
- package/dist/esm/{chunk-ZRWZIAF5.mjs → chunk-KM6IOJ6Y.mjs} +2 -2
- package/dist/esm/chunk-KTM6KVUJ.mjs +2 -0
- package/dist/esm/chunk-KTM6KVUJ.mjs.map +1 -0
- package/dist/esm/{chunk-AVPQOD67.mjs → chunk-KX43GEAB.mjs} +2 -2
- package/dist/esm/{chunk-DSKAMBBL.mjs → chunk-L25CRR2W.mjs} +2 -2
- package/dist/esm/{chunk-WKNX43KN.mjs → chunk-LGHPJTF3.mjs} +2 -2
- package/dist/esm/{chunk-ONFKJ57C.mjs → chunk-LHBMBCFC.mjs} +2 -2
- package/dist/esm/{chunk-37Y54PJ5.mjs → chunk-LYO22HMF.mjs} +2 -2
- package/dist/esm/{chunk-4DNCQM3S.mjs → chunk-MBEWPBGN.mjs} +2 -2
- package/dist/esm/{chunk-MOGPSSTD.mjs → chunk-ML7D2CVG.mjs} +2 -2
- package/dist/esm/{chunk-GBVRCWCD.mjs → chunk-NF7ZQQE3.mjs} +2 -2
- package/dist/esm/{chunk-YNT7JHMS.mjs → chunk-O4MRRWRI.mjs} +2 -2
- package/dist/esm/{chunk-BLLHTGAP.mjs → chunk-OVI7L7OG.mjs} +2 -2
- package/dist/esm/{chunk-LAAFLCDM.mjs → chunk-P2FTRAK3.mjs} +2 -2
- package/dist/esm/{chunk-TM7OZT3W.mjs → chunk-Q3CWUEXI.mjs} +2 -2
- package/dist/esm/{chunk-F2AIWA7L.mjs → chunk-RC43EXC4.mjs} +2 -2
- package/dist/esm/{chunk-NARS3JDH.mjs → chunk-RLH25IDA.mjs} +2 -2
- package/dist/esm/{chunk-HFWFDS6Y.mjs → chunk-RSO5YIDW.mjs} +2 -2
- package/dist/esm/chunk-RZGTHCJY.mjs +2 -0
- package/dist/esm/{chunk-AMCJQIOT.mjs.map → chunk-RZGTHCJY.mjs.map} +1 -1
- package/dist/esm/{chunk-KT3DT5GV.mjs → chunk-SPX2YFZN.mjs} +2 -2
- package/dist/esm/{chunk-AHWZA3GD.mjs → chunk-SY4HK6CC.mjs} +2 -2
- package/dist/esm/{chunk-II654QZU.mjs → chunk-TGW36YOD.mjs} +2 -2
- package/dist/esm/{chunk-FXUI3SSD.mjs → chunk-TQA6HY6A.mjs} +2 -2
- package/dist/esm/{chunk-KA5FX53Q.mjs → chunk-U3GE6IPF.mjs} +2 -2
- package/dist/esm/{chunk-JDNI5VIJ.mjs → chunk-UKVH4UGL.mjs} +2 -2
- package/dist/esm/{chunk-H457BI3I.mjs → chunk-UWLW2VLZ.mjs} +2 -2
- package/dist/esm/{chunk-2NHQQQZK.mjs → chunk-VGITSRT6.mjs} +2 -2
- package/dist/esm/{chunk-L2SDI7PI.mjs → chunk-VGJIATTB.mjs} +2 -2
- package/dist/esm/chunk-WYOFF5DJ.mjs +2 -0
- package/dist/esm/chunk-WYOFF5DJ.mjs.map +1 -0
- package/dist/esm/{chunk-NHKAQRJB.mjs → chunk-X7JNNNMC.mjs} +2 -2
- package/dist/esm/chunk-XIB6LX22.mjs +2 -0
- package/dist/esm/chunk-XIB6LX22.mjs.map +1 -0
- package/dist/esm/{chunk-KUL55M2H.mjs → chunk-YIQ3JFHW.mjs} +2 -2
- package/dist/esm/{chunk-WGIYSLH6.mjs → chunk-YP3VO6GM.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +0 -1
- package/dist/esm/cli/move.d.mts +0 -1
- package/dist/esm/client/core.d.mts +0 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +0 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +0 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +0 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +0 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +0 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +0 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +0 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +0 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +0 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +0 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +0 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +0 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +0 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +0 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +0 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +0 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +0 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +0 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +0 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +0 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +0 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +0 -1
- package/dist/esm/core/hex.d.mts +0 -1
- package/dist/esm/core/index.d.mts +0 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +0 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +3 -5
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +0 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +0 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +0 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +0 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +0 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +0 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +0 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +0 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +0 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +0 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +0 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +0 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +0 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +0 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +0 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +0 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +0 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +0 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -4
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +0 -1
- package/dist/esm/transactions/instances/identifier.d.mts +0 -1
- package/dist/esm/transactions/instances/index.d.mts +0 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +0 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +0 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +0 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +0 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +0 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +0 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +0 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +0 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +0 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +0 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +0 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +0 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -23
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +0 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +0 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +0 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +1 -10
- package/dist/esm/types/index.d.mts +0 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/types.d.mts +0 -1
- package/dist/esm/utils/const.d.mts +7 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +0 -1
- package/dist/esm/utils/index.d.mts +1 -2
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +0 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -2
- package/src/api/transactionSubmission/build.ts +1 -82
- package/src/internal/keyless.ts +11 -1
- package/src/transactions/index.ts +0 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +1 -55
- package/src/transactions/types.ts +0 -11
- package/src/types/index.ts +0 -1
- package/src/utils/const.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-3DQVGPFE.mjs +0 -2
- package/dist/esm/chunk-3DQVGPFE.mjs.map +0 -1
- package/dist/esm/chunk-4PBXTMN3.mjs +0 -2
- package/dist/esm/chunk-4PBXTMN3.mjs.map +0 -1
- package/dist/esm/chunk-AMCJQIOT.mjs +0 -2
- package/dist/esm/chunk-EEB7EZFO.mjs +0 -2
- package/dist/esm/chunk-EEB7EZFO.mjs.map +0 -1
- package/dist/esm/chunk-G2GN4LH5.mjs +0 -2
- package/dist/esm/chunk-G2GN4LH5.mjs.map +0 -1
- package/dist/esm/chunk-L56DQ4N3.mjs +0 -2
- package/dist/esm/chunk-L56DQ4N3.mjs.map +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
- package/dist/esm/transactions/script-composer/index.d.mts +0 -44
- package/dist/esm/transactions/script-composer/index.mjs +0 -2
- package/src/transactions/script-composer/index.ts +0 -76
- /package/dist/esm/{chunk-XKOSS5KC.mjs.map → chunk-26WX3UFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-HEHVWRMO.mjs.map → chunk-2E3BT4YW.mjs.map} +0 -0
- /package/dist/esm/{chunk-JLD7DLKM.mjs.map → chunk-2LQ4FTSR.mjs.map} +0 -0
- /package/dist/esm/{chunk-E2NYQVP3.mjs.map → chunk-2REHS35S.mjs.map} +0 -0
- /package/dist/esm/{chunk-QQM47PHZ.mjs.map → chunk-2YTHKFJZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IBMZYDAR.mjs.map → chunk-4IQZOAN7.mjs.map} +0 -0
- /package/dist/esm/{chunk-VCY3JGZM.mjs.map → chunk-4J2JYRV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-5AKSORBJ.mjs.map → chunk-5KCKWL2C.mjs.map} +0 -0
- /package/dist/esm/{chunk-WSFHH3BK.mjs.map → chunk-5O3RHPER.mjs.map} +0 -0
- /package/dist/esm/{chunk-AAATWCJT.mjs.map → chunk-7OHMMGS6.mjs.map} +0 -0
- /package/dist/esm/{chunk-L2QVUMBV.mjs.map → chunk-A3USS2NC.mjs.map} +0 -0
- /package/dist/esm/{chunk-DP3YPGIK.mjs.map → chunk-AGEJNSEX.mjs.map} +0 -0
- /package/dist/esm/{chunk-XT5T5LAP.mjs.map → chunk-BP45UJII.mjs.map} +0 -0
- /package/dist/esm/{chunk-SU2WB34N.mjs.map → chunk-CEW2NI3K.mjs.map} +0 -0
- /package/dist/esm/{chunk-6LLGRGCN.mjs.map → chunk-CPKG25HX.mjs.map} +0 -0
- /package/dist/esm/{chunk-X3JPX7T6.mjs.map → chunk-D54FD6XE.mjs.map} +0 -0
- /package/dist/esm/{chunk-YZ3YPLEU.mjs.map → chunk-DYELAVMR.mjs.map} +0 -0
- /package/dist/esm/{chunk-2QBCTW67.mjs.map → chunk-E2GPZCQI.mjs.map} +0 -0
- /package/dist/esm/{chunk-7WXDXBXK.mjs.map → chunk-EJKX6MGV.mjs.map} +0 -0
- /package/dist/esm/{chunk-HXXELLHN.mjs.map → chunk-ERDYU5YQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-CA3Q2X6B.mjs.map → chunk-ETF76XA3.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIRAXHDH.mjs.map → chunk-FD6FGKYY.mjs.map} +0 -0
- /package/dist/esm/{chunk-OKE3FXIP.mjs.map → chunk-FFCCBAEZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-K4TJRYGQ.mjs.map → chunk-FYYTCJS4.mjs.map} +0 -0
- /package/dist/esm/{chunk-3XCYCFYI.mjs.map → chunk-GX4CYRK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-5NJWJXSS.mjs.map → chunk-GZBVXXUL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IDNDUJOK.mjs.map → chunk-H7AALSJ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-SBCLBDCP.mjs.map → chunk-HBWIDPNN.mjs.map} +0 -0
- /package/dist/esm/{chunk-PW3ISXPN.mjs.map → chunk-HPZQGMSH.mjs.map} +0 -0
- /package/dist/esm/{chunk-OJBMR5CT.mjs.map → chunk-I5GENJBA.mjs.map} +0 -0
- /package/dist/esm/{transactions/script-composer/index.mjs.map → chunk-I5OYNCZS.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJUINAQE.mjs.map → chunk-II26BNYA.mjs.map} +0 -0
- /package/dist/esm/{chunk-YPBNYKOD.mjs.map → chunk-IQ4SCMB6.mjs.map} +0 -0
- /package/dist/esm/{chunk-4YEOOZ2N.mjs.map → chunk-IUSAYAEI.mjs.map} +0 -0
- /package/dist/esm/{chunk-6K4TOFCO.mjs.map → chunk-JGLEKXFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-DDVOBEJA.mjs.map → chunk-JIT2FYGE.mjs.map} +0 -0
- /package/dist/esm/{chunk-46L6BAJG.mjs.map → chunk-JONEH52T.mjs.map} +0 -0
- /package/dist/esm/{chunk-XUP6VABV.mjs.map → chunk-K62JTXWQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6PJH53CK.mjs.map → chunk-KCEI5JYS.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZRWZIAF5.mjs.map → chunk-KM6IOJ6Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-AVPQOD67.mjs.map → chunk-KX43GEAB.mjs.map} +0 -0
- /package/dist/esm/{chunk-DSKAMBBL.mjs.map → chunk-L25CRR2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-WKNX43KN.mjs.map → chunk-LGHPJTF3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONFKJ57C.mjs.map → chunk-LHBMBCFC.mjs.map} +0 -0
- /package/dist/esm/{chunk-37Y54PJ5.mjs.map → chunk-LYO22HMF.mjs.map} +0 -0
- /package/dist/esm/{chunk-4DNCQM3S.mjs.map → chunk-MBEWPBGN.mjs.map} +0 -0
- /package/dist/esm/{chunk-MOGPSSTD.mjs.map → chunk-ML7D2CVG.mjs.map} +0 -0
- /package/dist/esm/{chunk-GBVRCWCD.mjs.map → chunk-NF7ZQQE3.mjs.map} +0 -0
- /package/dist/esm/{chunk-YNT7JHMS.mjs.map → chunk-O4MRRWRI.mjs.map} +0 -0
- /package/dist/esm/{chunk-BLLHTGAP.mjs.map → chunk-OVI7L7OG.mjs.map} +0 -0
- /package/dist/esm/{chunk-LAAFLCDM.mjs.map → chunk-P2FTRAK3.mjs.map} +0 -0
- /package/dist/esm/{chunk-TM7OZT3W.mjs.map → chunk-Q3CWUEXI.mjs.map} +0 -0
- /package/dist/esm/{chunk-F2AIWA7L.mjs.map → chunk-RC43EXC4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NARS3JDH.mjs.map → chunk-RLH25IDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-HFWFDS6Y.mjs.map → chunk-RSO5YIDW.mjs.map} +0 -0
- /package/dist/esm/{chunk-KT3DT5GV.mjs.map → chunk-SPX2YFZN.mjs.map} +0 -0
- /package/dist/esm/{chunk-AHWZA3GD.mjs.map → chunk-SY4HK6CC.mjs.map} +0 -0
- /package/dist/esm/{chunk-II654QZU.mjs.map → chunk-TGW36YOD.mjs.map} +0 -0
- /package/dist/esm/{chunk-FXUI3SSD.mjs.map → chunk-TQA6HY6A.mjs.map} +0 -0
- /package/dist/esm/{chunk-KA5FX53Q.mjs.map → chunk-U3GE6IPF.mjs.map} +0 -0
- /package/dist/esm/{chunk-JDNI5VIJ.mjs.map → chunk-UKVH4UGL.mjs.map} +0 -0
- /package/dist/esm/{chunk-H457BI3I.mjs.map → chunk-UWLW2VLZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2NHQQQZK.mjs.map → chunk-VGITSRT6.mjs.map} +0 -0
- /package/dist/esm/{chunk-L2SDI7PI.mjs.map → chunk-VGJIATTB.mjs.map} +0 -0
- /package/dist/esm/{chunk-NHKAQRJB.mjs.map → chunk-X7JNNNMC.mjs.map} +0 -0
- /package/dist/esm/{chunk-KUL55M2H.mjs.map → chunk-YIQ3JFHW.mjs.map} +0 -0
- /package/dist/esm/{chunk-WGIYSLH6.mjs.map → chunk-YP3VO6GM.mjs.map} +0 -0
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import { AccountAddressInput } from "../../core";
|
|
5
5
|
import { generateTransaction } from "../../internal/transactionSubmission";
|
|
6
|
-
import {
|
|
7
|
-
InputGenerateTransactionPayloadData,
|
|
8
|
-
InputGenerateTransactionOptions,
|
|
9
|
-
AptosScriptComposer,
|
|
10
|
-
TransactionPayloadScript,
|
|
11
|
-
generateRawTransaction,
|
|
12
|
-
} from "../../transactions";
|
|
6
|
+
import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from "../../transactions";
|
|
13
7
|
import { MultiAgentTransaction } from "../../transactions/instances/multiAgentTransaction";
|
|
14
8
|
import { SimpleTransaction } from "../../transactions/instances/simpleTransaction";
|
|
15
9
|
import { AptosConfig } from "../aptosConfig";
|
|
16
|
-
import { Deserializer } from "../../bcs";
|
|
17
10
|
|
|
18
11
|
/**
|
|
19
12
|
* A class to handle all `Build` transaction operations.
|
|
@@ -100,80 +93,6 @@ export class Build {
|
|
|
100
93
|
return generateTransaction({ aptosConfig: this.config, ...args });
|
|
101
94
|
}
|
|
102
95
|
|
|
103
|
-
/**
|
|
104
|
-
* Build a transaction from a series of Move calls.
|
|
105
|
-
*
|
|
106
|
-
* This function allows you to create a transaction with a list of Move calls.
|
|
107
|
-
*
|
|
108
|
-
* Right now we only tested this logic with single signer and we will add support
|
|
109
|
-
* for mutli agent transactions if needed.
|
|
110
|
-
*
|
|
111
|
-
* @param args.sender - The sender account address.
|
|
112
|
-
* @param args.builder - The closure to construct the list of calls.
|
|
113
|
-
* @param args.options - Optional transaction configurations.
|
|
114
|
-
* @param args.withFeePayer - Whether there is a fee payer for the transaction.
|
|
115
|
-
*
|
|
116
|
-
* @returns SimpleTransaction
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
121
|
-
*
|
|
122
|
-
* const config = new AptosConfig({ network: Network.TESTNET });
|
|
123
|
-
* const aptos = new Aptos(config);
|
|
124
|
-
*
|
|
125
|
-
* async function runExample() {
|
|
126
|
-
* // Build a transaction from a chained series of Move calls.
|
|
127
|
-
* const transaction = await aptos.transaction.script_composer({
|
|
128
|
-
* sender: "0x1", // replace with a real sender account address
|
|
129
|
-
* builder: builder: async (builder) => {
|
|
130
|
-
* const coin = await builder.addBatchedCalls({
|
|
131
|
-
* function: "0x1::coin::withdraw",
|
|
132
|
-
* functionArguments: [CallArgument.new_signer(0), 1],
|
|
133
|
-
* typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
134
|
-
* });
|
|
135
|
-
*
|
|
136
|
-
* // Pass the returned value from the first function call to the second call
|
|
137
|
-
* const fungibleAsset = await builder.addBatchedCalls({
|
|
138
|
-
* function: "0x1::coin::coin_to_fungible_asset",
|
|
139
|
-
* functionArguments: [coin[0]],
|
|
140
|
-
* typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
141
|
-
* });
|
|
142
|
-
*
|
|
143
|
-
* await builder.addBatchedCalls({
|
|
144
|
-
* function: "0x1::primary_fungible_store::deposit",
|
|
145
|
-
* functionArguments: [singleSignerED25519SenderAccount.accountAddress, fungibleAsset[0]],
|
|
146
|
-
* typeArguments: [],
|
|
147
|
-
* });
|
|
148
|
-
* return builder;
|
|
149
|
-
* },
|
|
150
|
-
* options: {
|
|
151
|
-
* gasUnitPrice: 100, // specify your own gas unit price if needed
|
|
152
|
-
* maxGasAmount: 1000, // specify your own max gas amount if needed
|
|
153
|
-
* },
|
|
154
|
-
* });
|
|
155
|
-
*
|
|
156
|
-
* console.log(transaction);
|
|
157
|
-
* }
|
|
158
|
-
* runExample().catch(console.error);
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
async scriptComposer(args: {
|
|
162
|
-
sender: AccountAddressInput;
|
|
163
|
-
builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;
|
|
164
|
-
options?: InputGenerateTransactionOptions;
|
|
165
|
-
withFeePayer?: boolean;
|
|
166
|
-
}): Promise<SimpleTransaction> {
|
|
167
|
-
const builder = await args.builder(new AptosScriptComposer(this.config));
|
|
168
|
-
const bytes = builder.build();
|
|
169
|
-
const rawTxn = await generateRawTransaction({
|
|
170
|
-
aptosConfig: this.config,
|
|
171
|
-
payload: TransactionPayloadScript.load(new Deserializer(bytes)),
|
|
172
|
-
...args,
|
|
173
|
-
});
|
|
174
|
-
return new SimpleTransaction(rawTxn);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
96
|
/**
|
|
178
97
|
* Build a multi-agent transaction that allows multiple signers to authorize a transaction.
|
|
179
98
|
*
|
package/src/internal/keyless.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { MoveVector } from "../bcs";
|
|
|
31
31
|
import { generateTransaction } from "./transactionSubmission";
|
|
32
32
|
import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions";
|
|
33
33
|
import { KeylessError, KeylessErrorType } from "../errors";
|
|
34
|
+
import { FIREBASE_AUTH_ISS_PATTERN } from "../utils/const";
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Retrieves a pepper value based on the provided configuration and authentication details.
|
|
@@ -232,7 +233,16 @@ export async function updateFederatedKeylessJwkSetTransaction(args: {
|
|
|
232
233
|
options?: InputGenerateTransactionOptions;
|
|
233
234
|
}): Promise<SimpleTransaction> {
|
|
234
235
|
const { aptosConfig, sender, iss, options } = args;
|
|
235
|
-
|
|
236
|
+
|
|
237
|
+
let { jwksUrl } = args;
|
|
238
|
+
|
|
239
|
+
if (jwksUrl === undefined) {
|
|
240
|
+
if (FIREBASE_AUTH_ISS_PATTERN.test(iss)) {
|
|
241
|
+
jwksUrl = "https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com";
|
|
242
|
+
} else {
|
|
243
|
+
jwksUrl = iss.endsWith("/") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
236
246
|
|
|
237
247
|
let response: Response;
|
|
238
248
|
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
throwTypeMismatch,
|
|
46
46
|
convertNumber,
|
|
47
47
|
} from "./helpers";
|
|
48
|
-
import {
|
|
48
|
+
import { MoveFunction } from "../../types";
|
|
49
49
|
|
|
50
50
|
const TEXT_ENCODER = new TextEncoder();
|
|
51
51
|
|
|
@@ -92,34 +92,6 @@ 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
|
-
|
|
123
95
|
/**
|
|
124
96
|
* Fetches the ABI for an entry function from the specified module address.
|
|
125
97
|
* This function validates if the ABI corresponds to an entry function and retrieves its parameters.
|
|
@@ -211,32 +183,6 @@ export async function fetchViewFunctionAbi(
|
|
|
211
183
|
};
|
|
212
184
|
}
|
|
213
185
|
|
|
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
|
-
|
|
240
186
|
/**
|
|
241
187
|
* Converts a non-BCS encoded argument into BCS encoded, if necessary.
|
|
242
188
|
* This function checks the provided argument against the expected parameter type and converts it accordingly.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { CallArgument } from "@wgb5445/aptos-intent-npm";
|
|
5
4
|
import { AptosConfig } from "../api/aptosConfig";
|
|
6
5
|
import { MoveOption, MoveString, MoveVector } from "../bcs/serializable/moveStructs";
|
|
7
6
|
import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
|
|
@@ -165,16 +164,6 @@ export type InputMultiSigDataWithABI = {
|
|
|
165
164
|
* Combines input function data with Aptos configuration for remote ABI interactions.
|
|
166
165
|
*/
|
|
167
166
|
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
|
-
|
|
178
167
|
/**
|
|
179
168
|
* The data needed to generate a Multi Sig payload
|
|
180
169
|
*/
|
package/src/types/index.ts
CHANGED
package/src/utils/const.ts
CHANGED
|
@@ -65,3 +65,10 @@ export enum ProcessorType {
|
|
|
65
65
|
USER_TRANSACTION_PROCESSOR = "user_transaction_processor",
|
|
66
66
|
OBJECT_PROCESSOR = "objects_processor",
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Regular expression pattern for Firebase Auth issuer URLs
|
|
71
|
+
* Matches URLs in the format: https://securetoken.google.com/[project-id]
|
|
72
|
+
* where project-id can contain letters, numbers, hyphens, and underscores
|
|
73
|
+
*/
|
|
74
|
+
export const FIREBASE_AUTH_ISS_PATTERN = /^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-AHWZA3GD.mjs";import{a as i}from"./chunk-4PBXTMN3.mjs";import{e as a}from"./chunk-XKOSS5KC.mjs";import{a as r}from"./chunk-YNT7JHMS.mjs";import{c as e}from"./chunk-L2QVUMBV.mjs";import{a as o}from"./chunk-D52UKPQF.mjs";var s=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async scriptComposer(n){let p=(await n.builder(new i(this.config))).build(),c=await a({aptosConfig:this.config,payload:e.load(new o(p)),...n});return new r(c)}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{s as a};
|
|
2
|
-
//# sourceMappingURL=chunk-3DQVGPFE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/transactionSubmission/build.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../../core\";\nimport { generateTransaction } from \"../../internal/transactionSubmission\";\nimport {\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionOptions,\n AptosScriptComposer,\n TransactionPayloadScript,\n generateRawTransaction,\n} from \"../../transactions\";\nimport { MultiAgentTransaction } from \"../../transactions/instances/multiAgentTransaction\";\nimport { SimpleTransaction } from \"../../transactions/instances/simpleTransaction\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { Deserializer } from \"../../bcs\";\n\n/**\n * A class to handle all `Build` transaction operations.\n */\nexport class Build {\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 * @param config.account - The account details for authentication.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\", // specify the node URL\n * });\n *\n * // Initialize the Aptos client\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 * Build a simple transaction.\n *\n * This function allows you to create a transaction with specified sender and data.\n *\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a simple transaction\n * const transaction = await aptos.transaction.simple({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async simple(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Build a transaction from a series of Move calls.\n *\n * This function allows you to create a transaction with a list of Move calls.\n *\n * Right now we only tested this logic with single signer and we will add support\n * for mutli agent transactions if needed.\n *\n * @param args.sender - The sender account address.\n * @param args.builder - The closure to construct the list of calls.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a transaction from a chained series of Move calls.\n * const transaction = await aptos.transaction.script_composer({\n * sender: \"0x1\", // replace with a real sender account address\n * builder: builder: async (builder) => {\n * const coin = await builder.addBatchedCalls({\n * function: \"0x1::coin::withdraw\",\n * functionArguments: [CallArgument.new_signer(0), 1],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * // Pass the returned value from the first function call to the second call\n * const fungibleAsset = await builder.addBatchedCalls({\n * function: \"0x1::coin::coin_to_fungible_asset\",\n * functionArguments: [coin[0]],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * await builder.addBatchedCalls({\n * function: \"0x1::primary_fungible_store::deposit\",\n * functionArguments: [singleSignerED25519SenderAccount.accountAddress, fungibleAsset[0]],\n * typeArguments: [],\n * });\n * return builder;\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async scriptComposer(args: {\n sender: AccountAddressInput;\n builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n const builder = await args.builder(new AptosScriptComposer(this.config));\n const bytes = builder.build();\n const rawTxn = await generateRawTransaction({\n aptosConfig: this.config,\n payload: TransactionPayloadScript.load(new Deserializer(bytes)),\n ...args,\n });\n return new SimpleTransaction(rawTxn);\n }\n\n /**\n * Build a multi-agent transaction that allows multiple signers to authorize a transaction.\n *\n * @param args - The parameters for creating the multi-agent transaction.\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.secondarySignerAddresses - An array of the secondary signers' account addresses.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns MultiAgentTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a multi-agent transaction\n * const transaction = await aptos.multiAgent({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * // Transaction data structure\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address and amount\n * },\n * secondarySignerAddresses: [\"0x3\", \"0x4\"], // replace with real secondary signer addresses\n * options: {\n * // Optional transaction configurations\n * maxGasAmount: \"1000\",\n * gasUnitPrice: \"1\",\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async multiAgent(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n secondarySignerAddresses: AccountAddressInput[];\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<MultiAgentTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"sPAoBO,IAAMA,EAAN,KAAY,CA+BjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwCA,MAAM,OAAOC,EAKkB,CAC7B,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CA4DA,MAAM,eAAeA,EAKU,CAE7B,IAAME,GADU,MAAMF,EAAK,QAAQ,IAAIG,EAAoB,KAAK,MAAM,CAAC,GACjD,MAAM,EACtBC,EAAS,MAAMC,EAAuB,CAC1C,YAAa,KAAK,OAClB,QAASC,EAAyB,KAAK,IAAIC,EAAaL,CAAK,CAAC,EAC9D,GAAGF,CACL,CAAC,EACD,OAAO,IAAIQ,EAAkBJ,CAAM,CACrC,CA2CA,MAAM,WAAWJ,EAMkB,CACjC,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF","names":["Build","config","args","generateTransaction","bytes","AptosScriptComposer","rawTxn","generateRawTransaction","TransactionPayloadScript","Deserializer","SimpleTransaction"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as c,c as u,f as l}from"./chunk-G2GN4LH5.mjs";import{u as m}from"./chunk-WSFHH3BK.mjs";import{TransactionComposer as f,initSync as h,wasm as A}from"@wgb5445/aptos-intent-npm";(async()=>h({module:A}))();var g=class{constructor(t){this.builder=f.single_signer(),this.config=t}async addBatchedCalls(t){let{moduleAddress:r,moduleName:o,functionName:i}=m(t.function),s=this.config.getRequestUrl("Fullnode");if(await this.builder.load_module(s,`${r}::${o}`),t.typeArguments!==void 0)for(let e of t.typeArguments)await this.builder.load_type_tag(s,e.toString());let n=c(t.typeArguments),a=await u(r,o,i,this.config);if(n.length!==a.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${a.typeParameters.length}, received ${n.length}`);let d=t.functionArguments.map((e,p)=>l(e,i,a,p,n));return this.builder.add_batched_call(`${r}::${o}`,i,n.map(e=>e.toString()),d)}build(){return this.builder.generate_batched_calls(!0)}};export{g as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4PBXTMN3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/script-composer/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TransactionComposer, initSync, wasm } from \"@wgb5445/aptos-intent-npm\";\nimport { AptosApiType } from \"../../utils\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { InputBatchedFunctionData } from \"../types\";\nimport { fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from \"../transactionBuilder\";\nimport { CallArgument } from \"../../types\";\nimport { convertCallArgument } from \"../transactionBuilder/remoteAbi\";\n\n(async () => {\n initSync({ module: wasm });\n})();\n\n// A wrapper class around TransactionComposer, which is a WASM library compiled\n// from aptos-core/aptos-move/script-composer.\n//\n// This class allows the SDK caller to build a transaction that invokes multiple Move functions\n// and allow for arguments to be passed around.\nexport class AptosScriptComposer {\n private builder: TransactionComposer;\n\n private config: AptosConfig;\n\n constructor(aptosConfig: AptosConfig) {\n this.builder = TransactionComposer.single_signer();\n this.config = aptosConfig;\n }\n\n // Add a move function invocation to the TransactionComposer.\n //\n // Similar to how to create an entry function, the difference is that input arguments could\n // either be a `CallArgument` which represents an abstract value returned from a previous Move call\n // or the regular entry function arguments.\n //\n // The function would also return a list of `CallArgument` that can be passed on to future calls.\n async addBatchedCalls(input: InputBatchedFunctionData): Promise<CallArgument[]> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(input.function);\n const nodeUrl = this.config.getRequestUrl(AptosApiType.FULLNODE);\n\n // Load the calling module into the builder.\n await this.builder.load_module(nodeUrl, `${moduleAddress}::${moduleName}`);\n\n // Load the calling type arguments into the loader.\n if (input.typeArguments !== undefined) {\n for (const typeTag of input.typeArguments) {\n // eslint-disable-next-line no-await-in-loop\n await this.builder.load_type_tag(nodeUrl, typeTag.toString());\n }\n }\n const typeArguments = standardizeTypeTags(input.typeArguments);\n const functionAbi = await fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, this.config);\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 const functionArguments: CallArgument[] = input.functionArguments.map((arg, i) =>\n convertCallArgument(arg, functionName, functionAbi, i, typeArguments),\n );\n\n return this.builder.add_batched_call(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments.map((arg) => arg.toString()),\n functionArguments,\n );\n }\n\n build(): Uint8Array {\n return this.builder.generate_batched_calls(true);\n }\n}\n"],"mappings":"gGAGA,OAAS,uBAAAA,EAAqB,YAAAC,EAAU,QAAAC,MAAY,6BAQnD,SACCC,EAAS,CAAE,OAAQC,CAAK,CAAC,KAQpB,IAAMC,EAAN,KAA0B,CAK/B,YAAYC,EAA0B,CACpC,KAAK,QAAUC,EAAoB,cAAc,EACjD,KAAK,OAASD,CAChB,CASA,MAAM,gBAAgBE,EAA0D,CAC9E,GAAM,CAAE,cAAAC,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBJ,EAAM,QAAQ,EAC7EK,EAAU,KAAK,OAAO,wBAAmC,EAM/D,GAHA,MAAM,KAAK,QAAQ,YAAYA,EAAS,GAAGJ,CAAa,KAAKC,CAAU,EAAE,EAGrEF,EAAM,gBAAkB,OAC1B,QAAWM,KAAWN,EAAM,cAE1B,MAAM,KAAK,QAAQ,cAAcK,EAASC,EAAQ,SAAS,CAAC,EAGhE,IAAMC,EAAgBC,EAAoBR,EAAM,aAAa,EACvDS,EAAc,MAAMC,EAAqBT,EAAeC,EAAYC,EAAc,KAAK,MAAM,EAEnG,GAAII,EAAc,SAAWE,EAAY,eAAe,OACtD,MAAM,IAAI,MACR,0CAA0CA,EAAY,eAAe,MAAM,cAAcF,EAAc,MAAM,EAC/G,EAGF,IAAMI,EAAoCX,EAAM,kBAAkB,IAAI,CAACY,EAAKC,IAC1EC,EAAoBF,EAAKT,EAAcM,EAAaI,EAAGN,CAAa,CACtE,EAEA,OAAO,KAAK,QAAQ,iBAClB,GAAGN,CAAa,KAAKC,CAAU,GAC/BC,EACAI,EAAc,IAAKK,GAAQA,EAAI,SAAS,CAAC,EACzCD,CACF,CACF,CAEA,OAAoB,CAClB,OAAO,KAAK,QAAQ,uBAAuB,EAAI,CACjD,CACF","names":["TransactionComposer","initSync","wasm","initSync","wasm","AptosScriptComposer","aptosConfig","TransactionComposer","input","moduleAddress","moduleName","functionName","getFunctionParts","nodeUrl","typeTag","typeArguments","standardizeTypeTags","functionAbi","fetchMoveFunctionAbi","functionArguments","arg","i","convertCallArgument"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as v}from"./chunk-AHWZA3GD.mjs";import{g}from"./chunk-K4TJRYGQ.mjs";import{a as C}from"./chunk-ONFKJ57C.mjs";import{a as l}from"./chunk-WGIYSLH6.mjs";import{a as S}from"./chunk-YPBNYKOD.mjs";import{i as x,l as k,m as E,n as b,q as m}from"./chunk-XUP6VABV.mjs";import{b as h}from"./chunk-3XCYCFYI.mjs";import{e as K,f as A}from"./chunk-WKNX43KN.mjs";import{d as w}from"./chunk-F45G3GP3.mjs";import{a as u}from"./chunk-TM7OZT3W.mjs";import{b as f}from"./chunk-SPRNSFUV.mjs";import{jwtDecode as F}from"jwt-decode";async function j(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,uidKey:p="sub",derivationPath:i}=r,e={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),uid_key:p,derivation_path:i},{data:n}=await K({aptosConfig:s,path:"fetch",body:e,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return f.fromHexInput(n.pepper).toUint8Array()}async function I(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,pepper:p=await j(r),uidKey:i="sub",maxExpHorizonSecs:e=(await m({aptosConfig:s})).maxExpHorizonSecs}=r;if(f.fromHexInput(p).toUint8Array().length!==l.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${l.PEPPER_LENGTH} bytes`);let n=F(a);if(typeof n.iat!="number")throw new Error("iat was not found");if(e<t.expiryDateSecs-n.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${e}`);let o={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,exp_horizon_secs:e,pepper:f.fromHexInput(p).toStringWithoutPrefix(),uid_key:i},{data:c}=await A({aptosConfig:s,path:"prove",body:o,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),d=c.proof,y=new k({a:d.a,b:d.b,c:d.c});return new b({proof:new E(y,0),trainingWheelsSignature:h.fromHex(c.training_wheels_signature),expHorizonSecs:e})}async function ee(r){let{aptosConfig:s,jwt:a,jwkAddress:t,uidKey:p,proofFetchCallback:i,pepper:e=await j(r)}=r,{verificationKey:n,maxExpHorizonSecs:o}=await m({aptosConfig:s}),c=I({...r,pepper:e,maxExpHorizonSecs:o}),d=i?c:await c;if(t!==void 0){let _=S.fromJwtAndPepper({jwt:a,pepper:e,jwkAddress:t,uidKey:p}),H=await g({aptosConfig:s,authenticationKey:_.authKey().derivedAddress()});return C.create({...r,address:H,proof:d,pepper:e,proofFetchCallback:i,jwkAddress:t,verificationKey:n})}let y=x.fromJwtAndPepper({jwt:a,pepper:e,uidKey:p}),P=await g({aptosConfig:s,authenticationKey:y.authKey().derivedAddress()});return l.create({...r,address:P,proof:d,pepper:e,proofFetchCallback:i,verificationKey:n})}async function te(r){let{aptosConfig:s,sender:a,iss:t,options:p}=r,i=r.jwksUrl??(t.endsWith("/")?`${t}.well-known/jwks.json`:`${t}/.well-known/jwks.json`),e;try{if(e=await fetch(i),!e.ok)throw new Error(`${e.status} ${e.statusText}`)}catch(o){let c;throw o instanceof Error?c=`${o.message}`:c=`error unknown - ${o}`,w.fromErrorType({type:14,details:`Failed to fetch JWKS at ${i}: ${c}`})}let n=await e.json();return v({aptosConfig:s,sender:a.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[t,u.MoveString(n.keys.map(o=>o.kid)),u.MoveString(n.keys.map(o=>o.alg)),u.MoveString(n.keys.map(o=>o.e)),u.MoveString(n.keys.map(o=>o.n))]},options:p})}export{j as a,I as b,ee as c,te as d};
|
|
2
|
-
//# sourceMappingURL=chunk-EEB7EZFO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n */\nimport { jwtDecode, JwtPayload } from \"jwt-decode\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddressInput,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessPublicKey,\n MoveJWK,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessConfig,\n} from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from \"../types/keyless\";\nimport { lookupOriginalAccountAddress } from \"./account\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { MoveVector } from \"../bcs\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\n\n/**\n * Retrieves a pepper value based on the provided configuration and authentication details.\n *\n * @param args - The arguments required to fetch the pepper.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for the operation.\n * @param args.uidKey - An optional unique identifier key (defaults to \"sub\").\n * @param args.derivationPath - An optional derivation path for the key.\n * @returns A Uint8Array containing the fetched pepper value.\n */\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey = \"sub\", derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\n/**\n * Generates a zero-knowledge proof based on the provided parameters.\n * This function is essential for creating a signed proof that can be used in various cryptographic operations.\n *\n * @param args - The parameters required to generate the proof.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for generating the proof.\n * @param args.pepper - An optional hex input used to enhance security (default is generated if not provided).\n * @param args.uidKey - An optional string that specifies the unique identifier key (defaults to \"sub\").\n * @throws Error if the pepper length is not valid or if the ephemeral key pair's lifespan exceeds the maximum allowed.\n */\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n maxExpHorizonSecs?: number;\n}): Promise<ZeroKnowledgeSig> {\n const {\n aptosConfig,\n jwt,\n ephemeralKeyPair,\n pepper = await getPepper(args),\n uidKey = \"sub\",\n maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs,\n } = args;\n if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n const decodedJwt = jwtDecode<JwtPayload>(jwt);\n if (typeof decodedJwt.iat !== \"number\") {\n throw new Error(\"iat was not found\");\n }\n if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {\n throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: maxExpHorizonSecs,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n expHorizonSecs: maxExpHorizonSecs,\n });\n return signedProof;\n}\n\n/**\n * Derives a keyless account by fetching the necessary proof and looking up the original account address.\n * This function helps in creating a keyless account that can be used without managing private keys directly.\n *\n * @param args - The arguments required to derive the keyless account.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for cryptographic operations.\n * @param args.uidKey - An optional unique identifier key for the user.\n * @param args.pepper - An optional hexadecimal input used for additional security.\n * @param args.proofFetchCallback - An optional callback function to handle the proof fetch outcome.\n * @returns A keyless account object.\n */\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount | FederatedKeylessAccount> {\n const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;\n const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });\n\n const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });\n // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the\n // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch\n // allowing for faster rendering of UX.\n //\n // If no callback is provided, the just await the proof fetch and continue synchronously.\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n // Look up the original address to handle key rotations and then instantiate the account.\n if (jwkAddress !== undefined) {\n const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n\n return FederatedKeylessAccount.create({\n ...args,\n address,\n proof,\n pepper,\n proofFetchCallback,\n jwkAddress,\n verificationKey,\n });\n }\n\n const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });\n}\n\nexport interface JWKS {\n keys: MoveJWK[];\n}\n\nexport async function updateFederatedKeylessJwkSetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, iss, options } = args;\n const jwksUrl = args.jwksUrl ?? (iss.endsWith(\"/\") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`);\n\n let response: Response;\n\n try {\n response = await fetch(jwksUrl);\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n } catch (error) {\n let errorMessage: string;\n if (error instanceof Error) {\n errorMessage = `${error.message}`;\n } else {\n errorMessage = `error unknown - ${error}`;\n }\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWK_FETCH_FAILED_FEDERATED,\n details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`,\n });\n }\n\n const jwks: JWKS = await response.json();\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::jwks::update_federated_jwk_set\",\n functionArguments: [\n iss,\n MoveVector.MoveString(jwks.keys.map((key) => key.kid)),\n MoveVector.MoveString(jwks.keys.map((key) => key.alg)),\n MoveVector.MoveString(jwks.keys.map((key) => key.e)),\n MoveVector.MoveString(jwks.keys.map((key) => key.n)),\n ],\n },\n options,\n });\n}\n"],"mappings":"ieASA,OAAS,aAAAA,MAA6B,aAoCtC,eAAsBC,EAAUC,EAMR,CACtB,GAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAC,EAAS,MAAO,eAAAC,CAAe,EAAIL,EAEzEM,EAAO,CACX,QAASJ,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAeA,EAAiB,eAChC,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASC,EACT,gBAAiBC,CACnB,EACM,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAgE,CACrF,YAAAR,EACA,KAAM,QACN,KAAAK,EACA,aAAc,YACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACD,OAAOC,EAAI,aAAaC,EAAK,MAAM,EAAE,aAAa,CACpD,CAcA,eAAsBE,EAASV,EAOD,CAC5B,GAAM,CACJ,YAAAC,EACA,IAAAC,EACA,iBAAAC,EACA,OAAAQ,EAAS,MAAMZ,EAAUC,CAAI,EAC7B,OAAAI,EAAS,MACT,kBAAAQ,GAAqB,MAAMC,EAAiB,CAAE,YAAAZ,CAAY,CAAC,GAAG,iBAChE,EAAID,EACJ,GAAIO,EAAI,aAAaI,CAAM,EAAE,aAAa,EAAE,SAAWG,EAAe,cACpE,MAAM,IAAI,MAAM,sBAAsBA,EAAe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EAAa,MAAMJ,EAAS,KAAK,EACvC,OAAOK,EAAoB,CACzB,YAAA9C,EACA,OAAQqC,EAAO,eACf,KAAM,CACJ,SAAU,sCACV,kBAAmB,CACjBC,EACAS,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,EACnDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,CACrD,CACF,EACA,QAAAT,CACF,CAAC,CACH","names":["jwtDecode","getPepper","args","aptosConfig","jwt","ephemeralKeyPair","uidKey","derivationPath","body","Hex","data","postAptosPepperService","getProof","pepper","maxExpHorizonSecs","getKeylessConfig","KeylessAccount","decodedJwt","jwtDecode","json","postAptosProvingService","proofPoints","groth16Zkp","Groth16Zkp","ZeroKnowledgeSig","ZkProof","EphemeralSignature","deriveKeylessAccount","jwkAddress","proofFetchCallback","verificationKey","proofPromise","proof","publicKey","FederatedKeylessPublicKey","address","lookupOriginalAccountAddress","FederatedKeylessAccount","KeylessPublicKey","updateFederatedKeylessJwkSetTransaction","sender","iss","options","jwksUrl","response","error","errorMessage","KeylessError","jwks","generateTransaction","MoveVector","key"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as l}from"./chunk-AOROYJ74.mjs";import{a as k,b as y,d as g,e as w,f as z,g as D,h as L,i as d,j as R,l as X,m as q,n as H,o as J,p as K,q as Q,s as i,t as W}from"./chunk-WSFHH3BK.mjs";import{c as j}from"./chunk-K4TJRYGQ.mjs";import{b as C,c as x,d as a,e as M,f as _,g as O,h as V,i as G,n as P}from"./chunk-T6ADNZE5.mjs";import{b as m}from"./chunk-JNO7KPMG.mjs";import{a as T,c as I,d as f}from"./chunk-TM7OZT3W.mjs";import{a as A,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-42H7WETG.mjs";import{a as p}from"./chunk-L56DQ4N3.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(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 s=W(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(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 s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.new_bytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return U(t,s,u,r)}function U(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new A(n);if(y(n)){if(n==="true")return new A(!0);if(n==="false")return new A(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=g(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=g(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=g(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(w(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(w(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(w(n))return new S(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(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(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(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof a?new f(null):r instanceof M?new f(null):r instanceof _?new f(null):r instanceof O?new f(null):r instanceof V?new f(null):new f(null)}return new f(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 h(n,e,t){if(n.isBool()){if(L(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(X(e))return;i("U8",t)}if(n.isU16()){if(q(e))return;i("U16",t)}if(n.isU32()){if(H(e))return;i("U32",t)}if(n.isU64()){if(J(e))return;i("U64",t)}if(n.isU128()){if(K(e))return;i("U128",t)}if(n.isU256()){if(Q(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(R(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,U as h};
|
|
2
|
-
//# sourceMappingURL=chunk-G2GN4LH5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { CallArgument, MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a entry function argument into CallArgument, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param argument - The argument to be converted, which can be of various types. If the argument is already\n * CallArgument returned from TransactionComposer it would be returned immediately.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertCallArgument(\n argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n functionName: string,\n functionAbi: FunctionABI,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): CallArgument {\n if (argument instanceof CallArgument) {\n return argument;\n }\n return CallArgument.new_bytes(\n convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),\n );\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected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C,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchMoveFunctionAbi","functionAbi","params","i","fetchEntryFunctionAbi","numSigners","findFirstNonSignerArg","fetchViewFunctionAbi","returnTypes","convertCallArgument","argument","position","genericTypeParams","CallArgument","convertArgument","arg","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./indexer\";\nexport * from \"./types\";\nexport { CallArgument } from \"@wgb5445/aptos-intent-npm\";\n"],"mappings":"AAEA,OAAS,gBAAAA,MAAoB","names":["CallArgument"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-UIRAXHDH.mjs.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { AptosConfig } from '../../api/aptosConfig.mjs';
|
|
2
|
-
import { InputBatchedFunctionData } from '../types.mjs';
|
|
3
|
-
import { CallArgument } from '@wgb5445/aptos-intent-npm';
|
|
4
|
-
import '../../types/types.mjs';
|
|
5
|
-
import '../../types/indexer.mjs';
|
|
6
|
-
import '../../types/generated/operations.mjs';
|
|
7
|
-
import '../../types/generated/types.mjs';
|
|
8
|
-
import '../../utils/apiEndpoints.mjs';
|
|
9
|
-
import '../../utils/const.mjs';
|
|
10
|
-
import '../../bcs/serializable/moveStructs.mjs';
|
|
11
|
-
import '../../bcs/serializable/movePrimitives.mjs';
|
|
12
|
-
import '../../bcs/deserializer.mjs';
|
|
13
|
-
import '../../bcs/serializer.mjs';
|
|
14
|
-
import '../../core/hex.mjs';
|
|
15
|
-
import '../../core/common.mjs';
|
|
16
|
-
import '../instances/transactionArgument.mjs';
|
|
17
|
-
import '../../bcs/serializable/fixedBytes.mjs';
|
|
18
|
-
import '../../core/accountAddress.mjs';
|
|
19
|
-
import '../../publicKey-BVXX1nVl.mjs';
|
|
20
|
-
import '../../core/crypto/signature.mjs';
|
|
21
|
-
import '../instances/rawTransaction.mjs';
|
|
22
|
-
import '../instances/chainId.mjs';
|
|
23
|
-
import '../instances/transactionPayload.mjs';
|
|
24
|
-
import '../instances/identifier.mjs';
|
|
25
|
-
import '../instances/moduleId.mjs';
|
|
26
|
-
import '../typeTag/index.mjs';
|
|
27
|
-
import '../authenticator/account.mjs';
|
|
28
|
-
import '../../core/crypto/ed25519.mjs';
|
|
29
|
-
import '../../core/crypto/privateKey.mjs';
|
|
30
|
-
import '../../core/crypto/multiEd25519.mjs';
|
|
31
|
-
import '../../core/crypto/multiKey.mjs';
|
|
32
|
-
import '../../core/crypto/singleKey.mjs';
|
|
33
|
-
import '../instances/simpleTransaction.mjs';
|
|
34
|
-
import '../instances/multiAgentTransaction.mjs';
|
|
35
|
-
|
|
36
|
-
declare class AptosScriptComposer {
|
|
37
|
-
private builder;
|
|
38
|
-
private config;
|
|
39
|
-
constructor(aptosConfig: AptosConfig);
|
|
40
|
-
addBatchedCalls(input: InputBatchedFunctionData): Promise<CallArgument[]>;
|
|
41
|
-
build(): Uint8Array;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { AptosScriptComposer };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"../../chunk-4PBXTMN3.mjs";import"../../chunk-JXCZTOYC.mjs";import"../../chunk-XKOSS5KC.mjs";import"../../chunk-G2GN4LH5.mjs";import"../../chunk-AOROYJ74.mjs";import"../../chunk-WSFHH3BK.mjs";import"../../chunk-K4TJRYGQ.mjs";import"../../chunk-SU2WB34N.mjs";import"../../chunk-OJBMR5CT.mjs";import"../../chunk-PW3ISXPN.mjs";import"../../chunk-VHNX2NUR.mjs";import"../../chunk-GAEAYY44.mjs";import"../../chunk-GBVRCWCD.mjs";import"../../chunk-II654QZU.mjs";import"../../chunk-NARS3JDH.mjs";import"../../chunk-JLD7DLKM.mjs";import"../../chunk-ONFKJ57C.mjs";import"../../chunk-WGIYSLH6.mjs";import"../../chunk-H457BI3I.mjs";import"../../chunk-FXUI3SSD.mjs";import"../../chunk-4NMDYPUD.mjs";import"../../chunk-IBMZYDAR.mjs";import"../../chunk-HEHVWRMO.mjs";import"../../chunk-37Y54PJ5.mjs";import"../../chunk-YNT7JHMS.mjs";import"../../chunk-X3JPX7T6.mjs";import"../../chunk-L2QVUMBV.mjs";import"../../chunk-T6ADNZE5.mjs";import"../../chunk-ACVIE7IE.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-AVPQOD67.mjs";import"../../chunk-YZ3YPLEU.mjs";import"../../chunk-OPO5EYF7.mjs";import"../../chunk-LGTOOAQI.mjs";import"../../chunk-E7FWVXGX.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-6ZOVTYLJ.mjs";import"../../chunk-7WXDXBXK.mjs";import"../../chunk-HEZ2ZYZA.mjs";import"../../chunk-QQM47PHZ.mjs";import"../../chunk-BLLHTGAP.mjs";import"../../chunk-LAAFLCDM.mjs";import"../../chunk-KUL55M2H.mjs";import"../../chunk-YPBNYKOD.mjs";import"../../chunk-XUP6VABV.mjs";import"../../chunk-GMKKHGXK.mjs";import"../../chunk-UGTIALNW.mjs";import"../../chunk-3XCYCFYI.mjs";import"../../chunk-L2SDI7PI.mjs";import"../../chunk-5B3SMBXQ.mjs";import"../../chunk-AVZYJAXR.mjs";import"../../chunk-MHN6XY4Z.mjs";import"../../chunk-4O5XDQDO.mjs";import"../../chunk-OIOGOW6I.mjs";import"../../chunk-AKIO3OIT.mjs";import"../../chunk-HBIDHQ2M.mjs";import"../../chunk-JNO7KPMG.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-6LLGRGCN.mjs";import"../../chunk-WKNX43KN.mjs";import"../../chunk-KT3DT5GV.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-UZTJWOLS.mjs";import"../../chunk-F45G3GP3.mjs";import"../../chunk-D3OEQLUE.mjs";import"../../chunk-J245N3XF.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-ZMBXHMVQ.mjs";import"../../chunk-BRV3RLKW.mjs";import"../../chunk-TM7OZT3W.mjs";import"../../chunk-42H7WETG.mjs";import"../../chunk-L56DQ4N3.mjs";import"../../chunk-WQF3IOXC.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-AJ5JHBAE.mjs";import"../../chunk-SPRNSFUV.mjs";import"../../chunk-6Q2O5G3J.mjs";import"../../chunk-V4FKFCBL.mjs";import"../../chunk-D52UKPQF.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-AMCJQIOT.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as AptosScriptComposer};
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright © Aptos Foundation
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { TransactionComposer, initSync, wasm } from "@wgb5445/aptos-intent-npm";
|
|
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
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|