@aptos-labs/ts-sdk 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -5
- package/dist/browser/index.d.ts +1097 -519
- package/dist/browser/index.global.js +49 -28
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +1097 -519
- package/dist/common/index.js +48 -27
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.d.mts +72 -47
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +214 -18
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +9 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +2 -2
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +6 -5
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +24 -21
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +12 -14
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +4 -4
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +71 -30
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +12 -5
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +5 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.d.mts +13 -9
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +36 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +54 -0
- package/dist/esm/api/transactionSubmission/build.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.d.mts +51 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/simulate.d.mts +54 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/submit.d.mts +52 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission.d.mts +25 -54
- package/dist/esm/api/transactionSubmission.mjs +1 -1
- package/dist/esm/api/utils.d.mts +21 -0
- package/dist/esm/api/utils.mjs +2 -0
- package/dist/esm/api/utils.mjs.map +1 -0
- package/dist/esm/bcs/deserializer.d.mts +4 -4
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +4 -4
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-UAAI3NCA.mjs → chunk-2SAKPC5Q.mjs} +2 -2
- package/dist/esm/chunk-2YQXX64E.mjs +2 -0
- package/dist/esm/chunk-2YQXX64E.mjs.map +1 -0
- package/dist/esm/chunk-3F5WV6US.mjs +2 -0
- package/dist/esm/chunk-3F5WV6US.mjs.map +1 -0
- package/dist/esm/{chunk-ARVSIDVB.mjs → chunk-3RMXGSHK.mjs} +2 -2
- package/dist/esm/chunk-3RMXGSHK.mjs.map +1 -0
- package/dist/esm/{chunk-4ADA5BE7.mjs → chunk-53DS6NBQ.mjs} +2 -2
- package/dist/esm/chunk-5CUNY7X2.mjs +2 -0
- package/dist/esm/chunk-5CUNY7X2.mjs.map +1 -0
- package/dist/esm/{chunk-QWVR4RCV.mjs → chunk-5OPOJ43H.mjs} +2 -2
- package/dist/esm/{chunk-V45RFKH7.mjs → chunk-5UY5OKXR.mjs} +2 -2
- package/dist/esm/chunk-5UY5OKXR.mjs.map +1 -0
- package/dist/esm/chunk-5ZVCSKFX.mjs +2 -0
- package/dist/esm/chunk-5ZVCSKFX.mjs.map +1 -0
- package/dist/esm/{chunk-HVADSXTB.mjs → chunk-73VWOS4Z.mjs} +2 -2
- package/dist/esm/chunk-ALFESCPU.mjs +2 -0
- package/dist/esm/chunk-ALFESCPU.mjs.map +1 -0
- package/dist/esm/chunk-APSQ4M23.mjs +2 -0
- package/dist/esm/chunk-APSQ4M23.mjs.map +1 -0
- package/dist/esm/{chunk-U25N2VWA.mjs → chunk-AZUWHKN5.mjs} +2 -2
- package/dist/esm/{chunk-WX43AJTD.mjs → chunk-BQSE5HHW.mjs} +45 -24
- package/dist/esm/chunk-BQSE5HHW.mjs.map +1 -0
- package/dist/esm/chunk-CCXMVVXD.mjs +2 -0
- package/dist/esm/chunk-CCXMVVXD.mjs.map +1 -0
- package/dist/esm/{chunk-JZNLZMUC.mjs → chunk-CJPCOS4R.mjs} +2 -2
- package/dist/esm/{chunk-S36IYY6K.mjs → chunk-CL5B2QNS.mjs} +2 -2
- package/dist/esm/chunk-CLJLQXFQ.mjs +2 -0
- package/dist/esm/chunk-CLJLQXFQ.mjs.map +1 -0
- package/dist/esm/{chunk-EWTHPMEE.mjs → chunk-CU2DINU4.mjs} +2 -2
- package/dist/esm/chunk-EFRFDFS4.mjs +2 -0
- package/dist/esm/chunk-EFRFDFS4.mjs.map +1 -0
- package/dist/esm/chunk-EOC4UI5B.mjs +2 -0
- package/dist/esm/{chunk-KC64ESLO.mjs.map → chunk-EOC4UI5B.mjs.map} +1 -1
- package/dist/esm/{chunk-HA6JD5R6.mjs → chunk-F6K26WV5.mjs} +2 -2
- package/dist/esm/{chunk-HA6JD5R6.mjs.map → chunk-F6K26WV5.mjs.map} +1 -1
- package/dist/esm/chunk-F7EWDYTE.mjs +2 -0
- package/dist/esm/chunk-F7EWDYTE.mjs.map +1 -0
- package/dist/esm/{chunk-44MGBJ73.mjs → chunk-FZ56IS3E.mjs} +2 -2
- package/dist/esm/chunk-G36AY4R7.mjs +2 -0
- package/dist/esm/chunk-G36AY4R7.mjs.map +1 -0
- package/dist/esm/chunk-GEZSEAL5.mjs +2 -0
- package/dist/esm/chunk-GEZSEAL5.mjs.map +1 -0
- package/dist/esm/chunk-GIZLK7M7.mjs +2 -0
- package/dist/esm/chunk-GIZLK7M7.mjs.map +1 -0
- package/dist/esm/chunk-GMG4VR3K.mjs +2 -0
- package/dist/esm/chunk-GMG4VR3K.mjs.map +1 -0
- package/dist/esm/{chunk-U6SZNNVL.mjs → chunk-GXPGRCSW.mjs} +2 -2
- package/dist/esm/{chunk-U6SZNNVL.mjs.map → chunk-GXPGRCSW.mjs.map} +1 -1
- package/dist/esm/{chunk-GEFQFRL3.mjs → chunk-HC5VMNXA.mjs} +2 -2
- package/dist/esm/chunk-HTI5LEST.mjs +2 -0
- package/dist/esm/chunk-HTI5LEST.mjs.map +1 -0
- package/dist/esm/chunk-IELTCGLP.mjs +2 -0
- package/dist/esm/chunk-IELTCGLP.mjs.map +1 -0
- package/dist/esm/chunk-IHYTP2EW.mjs +1 -0
- package/dist/esm/chunk-IHYTP2EW.mjs.map +1 -0
- package/dist/esm/chunk-JI2BBZ2W.mjs +2 -0
- package/dist/esm/{chunk-3JVGSFHP.mjs.map → chunk-JI2BBZ2W.mjs.map} +1 -1
- package/dist/esm/chunk-KKER5KL4.mjs +2 -0
- package/dist/esm/chunk-KKER5KL4.mjs.map +1 -0
- package/dist/esm/chunk-KNMWDGP4.mjs +2 -0
- package/dist/esm/chunk-KNMWDGP4.mjs.map +1 -0
- package/dist/esm/{chunk-YYRDFZE6.mjs → chunk-KZSJ5MFF.mjs} +2 -2
- package/dist/esm/{chunk-YYRDFZE6.mjs.map → chunk-KZSJ5MFF.mjs.map} +1 -1
- package/dist/esm/chunk-MWAMLQ25.mjs +2 -0
- package/dist/esm/chunk-MWAMLQ25.mjs.map +1 -0
- package/dist/esm/chunk-NL72WE3E.mjs +2 -0
- package/dist/esm/{chunk-TIH6ARYP.mjs.map → chunk-NL72WE3E.mjs.map} +1 -1
- package/dist/esm/chunk-NZSGGL25.mjs +2 -0
- package/dist/esm/chunk-NZSGGL25.mjs.map +1 -0
- package/dist/esm/chunk-OBOOY2QD.mjs +2 -0
- package/dist/esm/chunk-OBOOY2QD.mjs.map +1 -0
- package/dist/esm/chunk-OT2UDMUU.mjs +2 -0
- package/dist/esm/chunk-OT2UDMUU.mjs.map +1 -0
- package/dist/esm/chunk-OZZDXS26.mjs +2 -0
- package/dist/esm/chunk-OZZDXS26.mjs.map +1 -0
- package/dist/esm/chunk-P5747ZYC.mjs +2 -0
- package/dist/esm/chunk-P5747ZYC.mjs.map +1 -0
- package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-PL2VA73L.mjs} +2 -2
- package/dist/esm/chunk-PXTMLJKO.mjs +2 -0
- package/dist/esm/{chunk-JDS7K2WI.mjs → chunk-QCBIJCU4.mjs} +2 -2
- package/dist/esm/chunk-QEXAMHPU.mjs +2 -0
- package/dist/esm/chunk-QEXAMHPU.mjs.map +1 -0
- package/dist/esm/{chunk-KQXRH5FK.mjs → chunk-QNTV5NMH.mjs} +2 -2
- package/dist/esm/{chunk-EQ5BEDJ7.mjs → chunk-RCM3K5JL.mjs} +2 -2
- package/dist/esm/chunk-RLG3WOTH.mjs +2 -0
- package/dist/esm/chunk-RLG3WOTH.mjs.map +1 -0
- package/dist/esm/chunk-SDPICQ5B.mjs +2 -0
- package/dist/esm/{chunk-FYIFBLHU.mjs.map → chunk-SDPICQ5B.mjs.map} +1 -1
- package/dist/esm/chunk-SGTFMSOG.mjs +2 -0
- package/dist/esm/chunk-SGTFMSOG.mjs.map +1 -0
- package/dist/esm/chunk-SO6EE5DX.mjs +2 -0
- package/dist/esm/chunk-SO6EE5DX.mjs.map +1 -0
- package/dist/esm/chunk-SRGPSANH.mjs +2 -0
- package/dist/esm/chunk-SRGPSANH.mjs.map +1 -0
- package/dist/esm/{chunk-UPLWWSB4.mjs → chunk-SSJQOXEP.mjs} +2 -2
- package/dist/esm/chunk-TZ623H2V.mjs +2 -0
- package/dist/esm/chunk-TZ623H2V.mjs.map +1 -0
- package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
- package/dist/esm/chunk-U6Z4FNB7.mjs.map +1 -0
- package/dist/esm/{chunk-GTC7WHMV.mjs → chunk-UDMADMVO.mjs} +1 -1
- package/dist/esm/{chunk-GTC7WHMV.mjs.map → chunk-UDMADMVO.mjs.map} +1 -1
- package/dist/esm/chunk-UIVJXLRM.mjs +1 -0
- package/dist/esm/chunk-UIVJXLRM.mjs.map +1 -0
- package/dist/esm/chunk-UKSA4H2O.mjs +2 -0
- package/dist/esm/chunk-UKSA4H2O.mjs.map +1 -0
- package/dist/esm/chunk-UW6HQ643.mjs +2 -0
- package/dist/esm/chunk-UW6HQ643.mjs.map +1 -0
- package/dist/esm/chunk-UWXDXOFK.mjs +2 -0
- package/dist/esm/chunk-UWXDXOFK.mjs.map +1 -0
- package/dist/esm/chunk-VQ7LYNMD.mjs +2 -0
- package/dist/esm/chunk-VQ7LYNMD.mjs.map +1 -0
- package/dist/esm/{chunk-U3LO2FSJ.mjs → chunk-WTGGCH34.mjs} +2 -2
- package/dist/esm/{chunk-X32O46IB.mjs → chunk-XITLXPBK.mjs} +2 -2
- package/dist/esm/chunk-XMUUI6HG.mjs +2 -0
- package/dist/esm/{chunk-R3KWVOFG.mjs.map → chunk-XMUUI6HG.mjs.map} +1 -1
- package/dist/esm/chunk-XX2Z26FH.mjs +2 -0
- package/dist/esm/chunk-XX2Z26FH.mjs.map +1 -0
- package/dist/esm/chunk-Y6PVFMBS.mjs +2 -0
- package/dist/esm/chunk-Y6PVFMBS.mjs.map +1 -0
- package/dist/esm/{chunk-VWVEDCBM.mjs → chunk-YN6UIVFB.mjs} +2 -2
- package/dist/esm/chunk-ZFK7QD3B.mjs +2 -0
- package/dist/esm/chunk-ZFK7QD3B.mjs.map +1 -0
- package/dist/esm/chunk-ZJUDDSWN.mjs +2 -0
- package/dist/esm/chunk-ZJUDDSWN.mjs.map +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +9 -9
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/anyPublicKey.d.mts +5 -0
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +3 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +2 -0
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +3 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -2
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +17 -10
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +20 -33
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +78 -14
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +6 -5
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +12 -21
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +5 -12
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +2 -2
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +40 -22
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +9 -5
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +4 -6
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +12 -4
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +29 -41
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +5 -0
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -0
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +5 -4
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +89 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
- package/dist/esm/transactions/management/asyncQueue.d.mts +58 -0
- package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
- package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
- package/dist/esm/transactions/management/index.d.mts +36 -0
- package/dist/esm/transactions/management/index.mjs +2 -0
- package/dist/esm/transactions/management/index.mjs.map +1 -0
- package/dist/esm/transactions/management/transactionWorker.d.mts +135 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
- package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -3
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -8
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +18 -43
- package/dist/esm/types/generated/operations.d.mts +30 -4
- package/dist/esm/types/generated/queries.d.mts +8 -5
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/index.d.mts +27 -9
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +3 -2
- package/dist/esm/utils/const.d.mts +18 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/api/account.ts +150 -53
- package/src/api/ans.ts +252 -16
- package/src/api/aptos.ts +20 -0
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/coin.ts +4 -8
- package/src/api/digitalAsset.ts +75 -25
- package/src/api/event.ts +28 -17
- package/src/api/faucet.ts +12 -9
- package/src/api/fungibleAsset.ts +76 -35
- package/src/api/general.ts +19 -3
- package/src/api/staking.ts +30 -11
- package/src/api/transaction.ts +16 -1
- package/src/api/transactionSubmission/build.ts +42 -0
- package/src/api/transactionSubmission/sign.ts +44 -0
- package/src/api/transactionSubmission/simulate.ts +56 -0
- package/src/api/transactionSubmission/submit.ts +53 -0
- package/src/api/transactionSubmission.ts +31 -128
- package/src/api/utils.ts +37 -0
- package/src/bcs/deserializer.ts +4 -4
- package/src/bcs/serializer.ts +4 -4
- package/src/client/core.ts +6 -4
- package/src/client/get.ts +7 -6
- package/src/core/accountAddress.ts +20 -22
- package/src/core/crypto/anyPublicKey.ts +12 -0
- package/src/core/crypto/ed25519.ts +13 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/secp256k1.ts +12 -0
- package/src/core/hex.ts +5 -7
- package/src/index.ts +1 -0
- package/src/internal/account.ts +56 -50
- package/src/internal/ans.ts +423 -24
- package/src/internal/coin.ts +6 -8
- package/src/internal/digitalAsset.ts +15 -25
- package/src/internal/event.ts +7 -14
- package/src/internal/faucet.ts +10 -6
- package/src/internal/fungibleAsset.ts +36 -18
- package/src/internal/general.ts +30 -3
- package/src/internal/queries/ansTokenFragment.graphql +9 -0
- package/src/internal/queries/getNames.graphql +11 -0
- package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +5 -5
- package/src/internal/queries/getProcessorStatus.graphql +2 -2
- package/src/internal/staking.ts +12 -14
- package/src/internal/transaction.ts +23 -26
- package/src/internal/transactionSubmission.ts +63 -25
- package/src/transactions/authenticator/account.ts +16 -0
- package/src/transactions/instances/moduleId.ts +1 -1
- package/src/transactions/management/accountSequenceNumber.ts +186 -0
- package/src/transactions/management/asyncQueue.ts +107 -0
- package/src/transactions/management/index.ts +2 -0
- package/src/transactions/management/transactionWorker.ts +275 -0
- package/src/transactions/transactionBuilder/helpers.ts +28 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +35 -28
- package/src/transactions/transactionBuilder/transactionBuilder.ts +46 -67
- package/src/transactions/typeTag/parser.ts +1 -1
- package/src/transactions/types.ts +16 -47
- package/src/types/generated/operations.ts +33 -2
- package/src/types/generated/queries.ts +38 -4
- package/src/types/index.ts +67 -11
- package/src/types/indexer.ts +3 -0
- package/src/utils/const.ts +18 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2W744GUN.mjs +0 -2
- package/dist/esm/chunk-2W744GUN.mjs.map +0 -1
- package/dist/esm/chunk-3JVGSFHP.mjs +0 -2
- package/dist/esm/chunk-4RVIA63I.mjs +0 -2
- package/dist/esm/chunk-4RVIA63I.mjs.map +0 -1
- package/dist/esm/chunk-62SCW5NH.mjs +0 -2
- package/dist/esm/chunk-62SCW5NH.mjs.map +0 -1
- package/dist/esm/chunk-7MNEEVXY.mjs +0 -2
- package/dist/esm/chunk-7MNEEVXY.mjs.map +0 -1
- package/dist/esm/chunk-AAIBCWZY.mjs +0 -2
- package/dist/esm/chunk-AAIBCWZY.mjs.map +0 -1
- package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
- package/dist/esm/chunk-BFSEVKNA.mjs +0 -2
- package/dist/esm/chunk-BFSEVKNA.mjs.map +0 -1
- package/dist/esm/chunk-BP5ZO7NK.mjs +0 -2
- package/dist/esm/chunk-BP5ZO7NK.mjs.map +0 -1
- package/dist/esm/chunk-BV4OOU5Y.mjs +0 -2
- package/dist/esm/chunk-BV4OOU5Y.mjs.map +0 -1
- package/dist/esm/chunk-BWMNPUTK.mjs +0 -2
- package/dist/esm/chunk-BWMNPUTK.mjs.map +0 -1
- package/dist/esm/chunk-EFIYW4WK.mjs +0 -2
- package/dist/esm/chunk-EGOYLZBU.mjs +0 -2
- package/dist/esm/chunk-EGOYLZBU.mjs.map +0 -1
- package/dist/esm/chunk-EYXHVA6W.mjs +0 -2
- package/dist/esm/chunk-EYXHVA6W.mjs.map +0 -1
- package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
- package/dist/esm/chunk-IG5CHHSI.mjs +0 -2
- package/dist/esm/chunk-IG5CHHSI.mjs.map +0 -1
- package/dist/esm/chunk-IXMB2GOK.mjs +0 -2
- package/dist/esm/chunk-IXMB2GOK.mjs.map +0 -1
- package/dist/esm/chunk-J5ZFOJN2.mjs +0 -2
- package/dist/esm/chunk-J5ZFOJN2.mjs.map +0 -1
- package/dist/esm/chunk-KC64ESLO.mjs +0 -2
- package/dist/esm/chunk-NGCFPQ22.mjs +0 -2
- package/dist/esm/chunk-NGCFPQ22.mjs.map +0 -1
- package/dist/esm/chunk-NTD3H2S4.mjs +0 -2
- package/dist/esm/chunk-NTD3H2S4.mjs.map +0 -1
- package/dist/esm/chunk-NYFVEKF6.mjs +0 -2
- package/dist/esm/chunk-NYFVEKF6.mjs.map +0 -1
- package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
- package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
- package/dist/esm/chunk-P32MY5YF.mjs +0 -2
- package/dist/esm/chunk-P32MY5YF.mjs.map +0 -1
- package/dist/esm/chunk-Q6N6QACD.mjs +0 -2
- package/dist/esm/chunk-Q6N6QACD.mjs.map +0 -1
- package/dist/esm/chunk-R26XML3D.mjs +0 -2
- package/dist/esm/chunk-R26XML3D.mjs.map +0 -1
- package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
- package/dist/esm/chunk-RYETO74W.mjs +0 -2
- package/dist/esm/chunk-RYETO74W.mjs.map +0 -1
- package/dist/esm/chunk-TCTZCPQ6.mjs +0 -1
- package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
- package/dist/esm/chunk-TQD4IGUM.mjs +0 -2
- package/dist/esm/chunk-TQD4IGUM.mjs.map +0 -1
- package/dist/esm/chunk-UNQNACJT.mjs +0 -2
- package/dist/esm/chunk-UNQNACJT.mjs.map +0 -1
- package/dist/esm/chunk-V45RFKH7.mjs.map +0 -1
- package/dist/esm/chunk-VMQWW5UT.mjs +0 -2
- package/dist/esm/chunk-VMQWW5UT.mjs.map +0 -1
- package/dist/esm/chunk-VOYW2TZW.mjs +0 -2
- package/dist/esm/chunk-VOYW2TZW.mjs.map +0 -1
- package/dist/esm/chunk-VYAVLUPJ.mjs +0 -2
- package/dist/esm/chunk-VYAVLUPJ.mjs.map +0 -1
- package/dist/esm/chunk-WKY5ENCK.mjs +0 -2
- package/dist/esm/chunk-WKY5ENCK.mjs.map +0 -1
- package/dist/esm/chunk-WX43AJTD.mjs.map +0 -1
- package/dist/esm/chunk-Y5DJPHJT.mjs +0 -2
- package/dist/esm/chunk-Y5DJPHJT.mjs.map +0 -1
- package/dist/esm/chunk-Y7VR7X5W.mjs +0 -2
- package/dist/esm/chunk-Y7VR7X5W.mjs.map +0 -1
- package/dist/esm/chunk-Z2UDRTHA.mjs +0 -2
- package/dist/esm/chunk-Z2UDRTHA.mjs.map +0 -1
- /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/transactionSubmission/build.mjs.map} +0 -0
- /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-2SAKPC5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ADA5BE7.mjs.map → chunk-53DS6NBQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-QWVR4RCV.mjs.map → chunk-5OPOJ43H.mjs.map} +0 -0
- /package/dist/esm/{chunk-HVADSXTB.mjs.map → chunk-73VWOS4Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-U25N2VWA.mjs.map → chunk-AZUWHKN5.mjs.map} +0 -0
- /package/dist/esm/{chunk-JZNLZMUC.mjs.map → chunk-CJPCOS4R.mjs.map} +0 -0
- /package/dist/esm/{chunk-S36IYY6K.mjs.map → chunk-CL5B2QNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EWTHPMEE.mjs.map → chunk-CU2DINU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-FZ56IS3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-GEFQFRL3.mjs.map → chunk-HC5VMNXA.mjs.map} +0 -0
- /package/dist/esm/{chunk-BPYLPPEQ.mjs.map → chunk-PL2VA73L.mjs.map} +0 -0
- /package/dist/esm/{chunk-EFIYW4WK.mjs.map → chunk-PXTMLJKO.mjs.map} +0 -0
- /package/dist/esm/{chunk-JDS7K2WI.mjs.map → chunk-QCBIJCU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-KQXRH5FK.mjs.map → chunk-QNTV5NMH.mjs.map} +0 -0
- /package/dist/esm/{chunk-EQ5BEDJ7.mjs.map → chunk-RCM3K5JL.mjs.map} +0 -0
- /package/dist/esm/{chunk-UPLWWSB4.mjs.map → chunk-SSJQOXEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3LO2FSJ.mjs.map → chunk-WTGGCH34.mjs.map} +0 -0
- /package/dist/esm/{chunk-X32O46IB.mjs.map → chunk-XITLXPBK.mjs.map} +0 -0
- /package/dist/esm/{chunk-VWVEDCBM.mjs.map → chunk-YN6UIVFB.mjs.map} +0 -0
package/src/api/general.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getChainTopUserTransactions,
|
|
9
9
|
getIndexerLastSuccessVersion,
|
|
10
10
|
getLedgerInfo,
|
|
11
|
+
getProcessorStatus,
|
|
11
12
|
getTableItem,
|
|
12
13
|
queryIndexer,
|
|
13
14
|
view,
|
|
@@ -16,13 +17,15 @@ import {
|
|
|
16
17
|
AnyNumber,
|
|
17
18
|
Block,
|
|
18
19
|
GetChainTopUserTransactionsResponse,
|
|
20
|
+
GetProcessorStatusResponse,
|
|
19
21
|
GraphqlQuery,
|
|
20
22
|
LedgerInfo,
|
|
21
|
-
|
|
23
|
+
LedgerVersionArg,
|
|
22
24
|
MoveValue,
|
|
23
25
|
TableItemRequest,
|
|
24
26
|
InputViewRequestData,
|
|
25
27
|
} from "../types";
|
|
28
|
+
import { ProcessorType } from "../utils/const";
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
31
|
* A class to query all `General` Aptos related queries
|
|
@@ -114,7 +117,7 @@ export class General {
|
|
|
114
117
|
*
|
|
115
118
|
* @returns Table item value rendered in JSON
|
|
116
119
|
*/
|
|
117
|
-
async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?:
|
|
120
|
+
async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {
|
|
118
121
|
return getTableItem<T>({ aptosConfig: this.config, ...args });
|
|
119
122
|
}
|
|
120
123
|
|
|
@@ -133,7 +136,10 @@ export class General {
|
|
|
133
136
|
*
|
|
134
137
|
* @returns an array of Move values
|
|
135
138
|
*/
|
|
136
|
-
async view<T extends Array<MoveValue>>(args: {
|
|
139
|
+
async view<T extends Array<MoveValue>>(args: {
|
|
140
|
+
payload: InputViewRequestData;
|
|
141
|
+
options?: LedgerVersionArg;
|
|
142
|
+
}): Promise<T> {
|
|
137
143
|
return view<T>({ aptosConfig: this.config, ...args });
|
|
138
144
|
}
|
|
139
145
|
|
|
@@ -185,4 +191,14 @@ export class General {
|
|
|
185
191
|
async getIndexerLastSuccessVersion(): Promise<number> {
|
|
186
192
|
return getIndexerLastSuccessVersion({ aptosConfig: this.config });
|
|
187
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Query the processor status for a specific processor type.
|
|
197
|
+
*
|
|
198
|
+
* @param processorType The processor type to query
|
|
199
|
+
* @returns
|
|
200
|
+
*/
|
|
201
|
+
async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {
|
|
202
|
+
return getProcessorStatus({ aptosConfig: this.config, processorType });
|
|
203
|
+
}
|
|
188
204
|
}
|
package/src/api/staking.ts
CHANGED
|
@@ -1,45 +1,57 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { AptosConfig } from "./aptosConfig";
|
|
5
4
|
import {
|
|
6
5
|
getDelegatedStakingActivities,
|
|
7
6
|
getNumberOfDelegators,
|
|
8
7
|
getNumberOfDelegatorsForAllPools,
|
|
9
8
|
} from "../internal/staking";
|
|
10
|
-
import { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse,
|
|
9
|
+
import { AnyNumber, GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from "../types";
|
|
11
10
|
import { AccountAddressInput } from "../core";
|
|
11
|
+
import { ProcessorType } from "../utils/const";
|
|
12
|
+
import { AptosConfig } from "./aptosConfig";
|
|
13
|
+
import { waitForIndexerOnVersion } from "./utils";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* A class to query all `Staking` related queries on Aptos.
|
|
15
17
|
*/
|
|
16
18
|
export class Staking {
|
|
17
|
-
readonly config: AptosConfig
|
|
18
|
-
|
|
19
|
-
constructor(config: AptosConfig) {
|
|
20
|
-
this.config = config;
|
|
21
|
-
}
|
|
19
|
+
constructor(readonly config: AptosConfig) {}
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* Queries current number of delegators in a pool. Throws an error if the pool is not found.
|
|
25
23
|
*
|
|
26
24
|
* @param args.poolAddress Pool address
|
|
25
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
27
26
|
* @returns The number of delegators for the given pool
|
|
28
27
|
*/
|
|
29
|
-
async getNumberOfDelegators(args: {
|
|
28
|
+
async getNumberOfDelegators(args: {
|
|
29
|
+
poolAddress: AccountAddressInput;
|
|
30
|
+
minimumLedgerVersion?: AnyNumber;
|
|
31
|
+
}): Promise<number> {
|
|
32
|
+
await waitForIndexerOnVersion({
|
|
33
|
+
config: this.config,
|
|
34
|
+
minimumLedgerVersion: args?.minimumLedgerVersion,
|
|
35
|
+
processorTypes: [ProcessorType.STAKE_PROCESSOR],
|
|
36
|
+
});
|
|
30
37
|
return getNumberOfDelegators({ aptosConfig: this.config, ...args });
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* Queries current number of delegators in a pool. Throws an error if the pool is not found.
|
|
35
42
|
*
|
|
43
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
36
44
|
* @returns GetNumberOfDelegatorsForAllPoolsResponse response type
|
|
37
45
|
*/
|
|
38
46
|
async getNumberOfDelegatorsForAllPools(args?: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
47
|
+
minimumLedgerVersion?: AnyNumber;
|
|
48
|
+
options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;
|
|
42
49
|
}): Promise<GetNumberOfDelegatorsResponse> {
|
|
50
|
+
await waitForIndexerOnVersion({
|
|
51
|
+
config: this.config,
|
|
52
|
+
minimumLedgerVersion: args?.minimumLedgerVersion,
|
|
53
|
+
processorTypes: [ProcessorType.STAKE_PROCESSOR],
|
|
54
|
+
});
|
|
43
55
|
return getNumberOfDelegatorsForAllPools({ aptosConfig: this.config, ...args });
|
|
44
56
|
}
|
|
45
57
|
|
|
@@ -48,12 +60,19 @@ export class Staking {
|
|
|
48
60
|
*
|
|
49
61
|
* @param args.delegatorAddress Delegator address
|
|
50
62
|
* @param args.poolAddress Pool address
|
|
63
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
51
64
|
* @returns GetDelegatedStakingActivitiesResponse response type
|
|
52
65
|
*/
|
|
53
66
|
async getDelegatedStakingActivities(args: {
|
|
54
67
|
delegatorAddress: AccountAddressInput;
|
|
55
68
|
poolAddress: AccountAddressInput;
|
|
69
|
+
minimumLedgerVersion?: AnyNumber;
|
|
56
70
|
}): Promise<GetDelegatedStakingActivitiesResponse> {
|
|
71
|
+
await waitForIndexerOnVersion({
|
|
72
|
+
config: this.config,
|
|
73
|
+
minimumLedgerVersion: args?.minimumLedgerVersion,
|
|
74
|
+
processorTypes: [ProcessorType.STAKE_PROCESSOR],
|
|
75
|
+
});
|
|
57
76
|
return getDelegatedStakingActivities({ aptosConfig: this.config, ...args });
|
|
58
77
|
}
|
|
59
78
|
}
|
package/src/api/transaction.ts
CHANGED
|
@@ -12,12 +12,15 @@ import {
|
|
|
12
12
|
} from "../internal/transaction";
|
|
13
13
|
import {
|
|
14
14
|
AnyNumber,
|
|
15
|
+
CommittedTransactionResponse,
|
|
15
16
|
GasEstimation,
|
|
16
17
|
HexInput,
|
|
17
18
|
PaginationArgs,
|
|
18
19
|
TransactionResponse,
|
|
19
20
|
WaitForTransactionOptions,
|
|
20
21
|
} from "../types";
|
|
22
|
+
import { getSigningMessage } from "../internal/transactionSubmission";
|
|
23
|
+
import { AnyRawTransaction } from "../transactions";
|
|
21
24
|
|
|
22
25
|
export class Transaction {
|
|
23
26
|
readonly config: AptosConfig;
|
|
@@ -112,7 +115,7 @@ export class Transaction {
|
|
|
112
115
|
async waitForTransaction(args: {
|
|
113
116
|
transactionHash: HexInput;
|
|
114
117
|
options?: WaitForTransactionOptions;
|
|
115
|
-
}): Promise<
|
|
118
|
+
}): Promise<CommittedTransactionResponse> {
|
|
116
119
|
return waitForTransaction({
|
|
117
120
|
aptosConfig: this.config,
|
|
118
121
|
...args,
|
|
@@ -139,4 +142,16 @@ export class Transaction {
|
|
|
139
142
|
aptosConfig: this.config,
|
|
140
143
|
});
|
|
141
144
|
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Returns a signing message for a transaction.
|
|
148
|
+
*
|
|
149
|
+
* This allows a user to sign a transaction using their own preferred signing method, and
|
|
150
|
+
* then submit it to the network.
|
|
151
|
+
* @param args.transaction A raw transaction for signing elsewhere
|
|
152
|
+
*/
|
|
153
|
+
// eslint-disable-next-line class-methods-use-this
|
|
154
|
+
getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
|
|
155
|
+
return getSigningMessage(args);
|
|
156
|
+
}
|
|
142
157
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AccountAddressInput } from "../../core";
|
|
5
|
+
import { generateTransaction } from "../../internal/transactionSubmission";
|
|
6
|
+
import {
|
|
7
|
+
InputGenerateTransactionPayloadData,
|
|
8
|
+
InputGenerateTransactionOptions,
|
|
9
|
+
SingleSignerTransaction,
|
|
10
|
+
MultiAgentTransaction,
|
|
11
|
+
} from "../../transactions";
|
|
12
|
+
import { AptosConfig } from "../aptosConfig";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A class to handle all `Build` transaction operations
|
|
16
|
+
*/
|
|
17
|
+
export class Build {
|
|
18
|
+
readonly config: AptosConfig;
|
|
19
|
+
|
|
20
|
+
constructor(config: AptosConfig) {
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async transaction(args: {
|
|
25
|
+
sender: AccountAddressInput;
|
|
26
|
+
data: InputGenerateTransactionPayloadData;
|
|
27
|
+
options?: InputGenerateTransactionOptions;
|
|
28
|
+
withFeePayer?: boolean;
|
|
29
|
+
}): Promise<SingleSignerTransaction> {
|
|
30
|
+
return generateTransaction({ aptosConfig: this.config, ...args });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async multiAgentTransaction(args: {
|
|
34
|
+
sender: AccountAddressInput;
|
|
35
|
+
data: InputGenerateTransactionPayloadData;
|
|
36
|
+
secondarySignerAddresses: AccountAddressInput[];
|
|
37
|
+
options?: InputGenerateTransactionOptions;
|
|
38
|
+
withFeePayer?: boolean;
|
|
39
|
+
}): Promise<MultiAgentTransaction> {
|
|
40
|
+
return generateTransaction({ aptosConfig: this.config, ...args });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Account } from "../../core";
|
|
5
|
+
import { signTransaction } from "../../internal/transactionSubmission";
|
|
6
|
+
import { AccountAuthenticator, AnyRawTransaction } from "../../transactions";
|
|
7
|
+
import { AptosConfig } from "../aptosConfig";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A class to handle all `Sign` transaction operations
|
|
11
|
+
*/
|
|
12
|
+
export class Sign {
|
|
13
|
+
readonly config: AptosConfig;
|
|
14
|
+
|
|
15
|
+
constructor(config: AptosConfig) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line class-methods-use-this
|
|
20
|
+
transaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
|
|
21
|
+
return signTransaction({
|
|
22
|
+
...args,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line class-methods-use-this
|
|
27
|
+
transactionAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
|
|
28
|
+
const { signer, transaction } = args;
|
|
29
|
+
|
|
30
|
+
// if transaction doesnt hold a "feePayerAddress" prop it means
|
|
31
|
+
// this is not a fee payer transaction
|
|
32
|
+
if (!transaction.feePayerAddress) {
|
|
33
|
+
throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Set the feePayerAddress to the signer account address
|
|
37
|
+
transaction.feePayerAddress = signer.accountAddress;
|
|
38
|
+
|
|
39
|
+
return signTransaction({
|
|
40
|
+
signer,
|
|
41
|
+
transaction,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PublicKey } from "../../core";
|
|
5
|
+
import { simulateTransaction } from "../../internal/transactionSubmission";
|
|
6
|
+
import { AnyRawTransaction, InputSimulateTransactionOptions } from "../../transactions";
|
|
7
|
+
import { UserTransactionResponse } from "../../types";
|
|
8
|
+
import { AptosConfig } from "../aptosConfig";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A class to handle all `Simulate` transaction operations
|
|
12
|
+
*/
|
|
13
|
+
export class Simulate {
|
|
14
|
+
readonly config: AptosConfig;
|
|
15
|
+
|
|
16
|
+
constructor(config: AptosConfig) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@ValidateFeePayerData
|
|
21
|
+
async transaction(args: {
|
|
22
|
+
signerPublicKey: PublicKey;
|
|
23
|
+
transaction: AnyRawTransaction;
|
|
24
|
+
feePayerPublicKey?: PublicKey;
|
|
25
|
+
options?: InputSimulateTransactionOptions;
|
|
26
|
+
}): Promise<Array<UserTransactionResponse>> {
|
|
27
|
+
return simulateTransaction({ aptosConfig: this.config, ...args });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ValidateFeePayerData
|
|
31
|
+
async multiAgentTransaction(args: {
|
|
32
|
+
signerPublicKey: PublicKey;
|
|
33
|
+
transaction: AnyRawTransaction;
|
|
34
|
+
secondarySignersPublicKeys: Array<PublicKey>;
|
|
35
|
+
feePayerPublicKey?: PublicKey;
|
|
36
|
+
options?: InputSimulateTransactionOptions;
|
|
37
|
+
}): Promise<Array<UserTransactionResponse>> {
|
|
38
|
+
return simulateTransaction({ aptosConfig: this.config, ...args });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ValidateFeePayerData(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
43
|
+
const originalMethod = descriptor.value;
|
|
44
|
+
/* eslint-disable-next-line func-names, no-param-reassign */
|
|
45
|
+
descriptor.value = async function (...args: any[]) {
|
|
46
|
+
const [methodArgs] = args;
|
|
47
|
+
|
|
48
|
+
if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerPublicKey) {
|
|
49
|
+
throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return originalMethod.apply(this, args);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return descriptor;
|
|
56
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { submitTransaction } from "../../internal/transactionSubmission";
|
|
5
|
+
import { AccountAuthenticator, AnyRawTransaction } from "../../transactions";
|
|
6
|
+
import { PendingTransactionResponse } from "../../types";
|
|
7
|
+
import { AptosConfig } from "../aptosConfig";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A class to handle all `Submit` transaction operations
|
|
11
|
+
*/
|
|
12
|
+
export class Submit {
|
|
13
|
+
readonly config: AptosConfig;
|
|
14
|
+
|
|
15
|
+
constructor(config: AptosConfig) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@ValidateFeePayerData
|
|
20
|
+
async transaction(args: {
|
|
21
|
+
transaction: AnyRawTransaction;
|
|
22
|
+
senderAuthenticator: AccountAuthenticator;
|
|
23
|
+
feePayerAuthenticator?: AccountAuthenticator;
|
|
24
|
+
}): Promise<PendingTransactionResponse> {
|
|
25
|
+
return submitTransaction({ aptosConfig: this.config, ...args });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@ValidateFeePayerData
|
|
29
|
+
async multiAgentTransaction(args: {
|
|
30
|
+
transaction: AnyRawTransaction;
|
|
31
|
+
senderAuthenticator: AccountAuthenticator;
|
|
32
|
+
additionalSignersAuthenticators: Array<AccountAuthenticator>;
|
|
33
|
+
feePayerAuthenticator?: AccountAuthenticator;
|
|
34
|
+
}): Promise<PendingTransactionResponse> {
|
|
35
|
+
return submitTransaction({ aptosConfig: this.config, ...args });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ValidateFeePayerData(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
40
|
+
const originalMethod = descriptor.value;
|
|
41
|
+
/* eslint-disable-next-line func-names, no-param-reassign */
|
|
42
|
+
descriptor.value = async function (...args: any[]) {
|
|
43
|
+
const [methodArgs] = args;
|
|
44
|
+
|
|
45
|
+
if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerAuthenticator) {
|
|
46
|
+
throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return originalMethod.apply(this, args);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return descriptor;
|
|
53
|
+
}
|
|
@@ -3,30 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
import { AptosConfig } from "./aptosConfig";
|
|
5
5
|
import { Account, AccountAddressInput, PrivateKey } from "../core";
|
|
6
|
-
import { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
7
6
|
import {
|
|
8
7
|
AnyRawTransaction,
|
|
9
|
-
|
|
10
|
-
InputGenerateMultiAgentRawTransactionData,
|
|
11
|
-
InputGenerateTransactionData,
|
|
12
|
-
InputGenerateFeePayerRawTransactionData,
|
|
13
|
-
InputGenerateSingleSignerRawTransactionData,
|
|
14
|
-
InputMultiAgentTransaction,
|
|
15
|
-
InputSingleSignerTransaction,
|
|
16
|
-
InputSimulateTransactionData,
|
|
8
|
+
SingleSignerTransaction,
|
|
17
9
|
InputGenerateTransactionOptions,
|
|
18
|
-
|
|
10
|
+
InputGenerateTransactionPayloadData,
|
|
19
11
|
} from "../transactions/types";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
publicPackageTransaction,
|
|
24
|
-
rotateAuthKey,
|
|
25
|
-
signAndSubmitTransaction,
|
|
26
|
-
signTransaction,
|
|
27
|
-
simulateTransaction,
|
|
28
|
-
submitTransaction,
|
|
29
|
-
} from "../internal/transactionSubmission";
|
|
12
|
+
import { PendingTransactionResponse, HexInput, TransactionResponse } from "../types";
|
|
13
|
+
import { publicPackageTransaction, rotateAuthKey, signAndSubmitTransaction } from "../internal/transactionSubmission";
|
|
14
|
+
import { TransactionWorker } from "../transactions/management";
|
|
30
15
|
|
|
31
16
|
export class TransactionSubmission {
|
|
32
17
|
readonly config: AptosConfig;
|
|
@@ -36,121 +21,39 @@ export class TransactionSubmission {
|
|
|
36
21
|
}
|
|
37
22
|
|
|
38
23
|
/**
|
|
39
|
-
*
|
|
40
|
-
* These are the possible function signature for `generateTransaction` function.
|
|
41
|
-
* When we call `generateTransaction` function with the relevant type properties,
|
|
42
|
-
* Typescript can infer the return type based on the appropriate function overload.
|
|
43
|
-
*/
|
|
44
|
-
async generateTransaction(args: InputGenerateSingleSignerRawTransactionData): Promise<InputSingleSignerTransaction>;
|
|
45
|
-
async generateTransaction(args: InputGenerateFeePayerRawTransactionData): Promise<InputFeePayerTransaction>;
|
|
46
|
-
async generateTransaction(args: InputGenerateMultiAgentRawTransactionData): Promise<InputMultiAgentTransaction>;
|
|
47
|
-
async generateTransaction(args: InputGenerateTransactionData): Promise<AnyRawTransaction>;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Generates any transaction by passing in the required arguments
|
|
24
|
+
* Batch transactions for a single account.
|
|
51
25
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @param args.options optional. GenerateTransactionOptions type
|
|
26
|
+
* This function uses a transaction worker that receives payloads to be processed
|
|
27
|
+
* and submitted to chain.
|
|
28
|
+
* Note that this process is best for submitting multiple transactions that
|
|
29
|
+
* dont rely on each other, i.e batch funds, batch token mints, etc.
|
|
57
30
|
*
|
|
58
|
-
*
|
|
59
|
-
* For a single signer entry function
|
|
60
|
-
* move function name, move function type arguments, move function arguments
|
|
61
|
-
* `
|
|
62
|
-
* data: {
|
|
63
|
-
* function: "0x1::aptos_account::transfer",
|
|
64
|
-
* typeArguments: []
|
|
65
|
-
* functionArguments: [receiverAddress,10]
|
|
66
|
-
* }
|
|
67
|
-
* `
|
|
31
|
+
* If any worker failure, the functions throws an error.
|
|
68
32
|
*
|
|
69
|
-
* @
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* ```
|
|
73
|
-
* data: {
|
|
74
|
-
* bytecode: "0x001234567",
|
|
75
|
-
* typeArguments: [],
|
|
76
|
-
* functionArguments: [receiverAddress,10]
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
33
|
+
* @param args.sender The sender account to sign and submit the transaction
|
|
34
|
+
* @param args.data An array of transaction payloads
|
|
35
|
+
* @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)
|
|
79
36
|
*
|
|
80
|
-
* @return
|
|
81
|
-
* ```
|
|
82
|
-
* {
|
|
83
|
-
* rawTransaction: RawTransaction,
|
|
84
|
-
* secondarySignerAddresses? : Array<AccountAddress>,
|
|
85
|
-
* feePayerAddress?: AccountAddress
|
|
86
|
-
* }
|
|
87
|
-
* ```
|
|
37
|
+
* @return void. Throws if any error
|
|
88
38
|
*/
|
|
89
|
-
async
|
|
90
|
-
|
|
91
|
-
|
|
39
|
+
async batchTransactionsForSingleAccount(args: {
|
|
40
|
+
sender: Account;
|
|
41
|
+
data: InputGenerateTransactionPayloadData[];
|
|
42
|
+
options?: Omit<InputGenerateTransactionOptions, "accountSequenceNumber">;
|
|
43
|
+
}): Promise<void> {
|
|
44
|
+
try {
|
|
45
|
+
const { sender, data, options } = args;
|
|
46
|
+
const transactionWorker = new TransactionWorker(this.config, sender);
|
|
92
47
|
|
|
93
|
-
|
|
94
|
-
* Sign a transaction that can later be submitted to chain
|
|
95
|
-
*
|
|
96
|
-
* @param args.signer The signer account to sign the transaction
|
|
97
|
-
* @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses
|
|
98
|
-
* @param args.asFeePayer optional. If the signer is also the fee payer
|
|
99
|
-
* ```
|
|
100
|
-
* {
|
|
101
|
-
* rawTransaction: RawTransaction,
|
|
102
|
-
* secondarySignerAddresses?: Array<AccountAddress>,
|
|
103
|
-
* feePayerAddress?: AccountAddress
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @return The signer AccountAuthenticator
|
|
108
|
-
*/
|
|
109
|
-
/* eslint-disable class-methods-use-this */
|
|
110
|
-
signTransaction(args: {
|
|
111
|
-
signer: Account;
|
|
112
|
-
transaction: AnyRawTransaction;
|
|
113
|
-
asFeePayer?: boolean;
|
|
114
|
-
}): AccountAuthenticator {
|
|
115
|
-
const { signer, transaction, asFeePayer } = args;
|
|
48
|
+
transactionWorker.start();
|
|
116
49
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
50
|
+
for (const d of data) {
|
|
51
|
+
/* eslint-disable no-await-in-loop */
|
|
52
|
+
await transactionWorker.push(d, options);
|
|
53
|
+
}
|
|
54
|
+
} catch (error: any) {
|
|
55
|
+
throw new Error(`failed to submit transactions with error: ${error}`);
|
|
122
56
|
}
|
|
123
|
-
|
|
124
|
-
return signTransaction({
|
|
125
|
-
signer,
|
|
126
|
-
transaction,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Simulates a transaction before singing it.
|
|
132
|
-
*
|
|
133
|
-
* @param args.signerPublicKey The signer public key
|
|
134
|
-
* @param args.transaction The raw transaction to simulate
|
|
135
|
-
* @param args.secondarySignersPublicKeys optional. For when the transaction is a multi signers transaction
|
|
136
|
-
* @param args.feePayerPublicKey optional. For when the transaction is a fee payer (aka sponsored) transaction
|
|
137
|
-
* @param args.options optional. A config to simulate the transaction with
|
|
138
|
-
*/
|
|
139
|
-
async simulateTransaction(args: InputSimulateTransactionData): Promise<Array<UserTransactionResponse>> {
|
|
140
|
-
return simulateTransaction({ aptosConfig: this.config, ...args });
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Submit transaction to chain
|
|
145
|
-
*
|
|
146
|
-
* @param args.transaction A aptos transaction type
|
|
147
|
-
* @param args.senderAuthenticator The account authenticator of the transaction sender
|
|
148
|
-
* @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction
|
|
149
|
-
*
|
|
150
|
-
* @return PendingTransactionResponse
|
|
151
|
-
*/
|
|
152
|
-
async submitTransaction(args: InputSubmitTransactionData): Promise<PendingTransactionResponse> {
|
|
153
|
-
return submitTransaction({ aptosConfig: this.config, ...args });
|
|
154
57
|
}
|
|
155
58
|
|
|
156
59
|
/**
|
|
@@ -198,7 +101,7 @@ export class TransactionSubmission {
|
|
|
198
101
|
metadataBytes: HexInput;
|
|
199
102
|
moduleBytecode: Array<HexInput>;
|
|
200
103
|
options?: InputGenerateTransactionOptions;
|
|
201
|
-
}): Promise<
|
|
104
|
+
}): Promise<SingleSignerTransaction> {
|
|
202
105
|
return publicPackageTransaction({ aptosConfig: this.config, ...args });
|
|
203
106
|
}
|
|
204
107
|
|
package/src/api/utils.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { waitForIndexer } from "../internal/transaction";
|
|
2
|
+
import { ProcessorType } from "../utils";
|
|
3
|
+
import { AptosConfig } from "./aptosConfig";
|
|
4
|
+
import { AnyNumber } from "../types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Utility function to handle optional waiting on indexer for APIs
|
|
8
|
+
*
|
|
9
|
+
* This is purposely placed here to not expose this internal function.
|
|
10
|
+
* @param args
|
|
11
|
+
*/
|
|
12
|
+
export async function waitForIndexerOnVersion(args: {
|
|
13
|
+
config: AptosConfig;
|
|
14
|
+
minimumLedgerVersion?: AnyNumber;
|
|
15
|
+
processorTypes: Array<ProcessorType>;
|
|
16
|
+
}) {
|
|
17
|
+
if (args.minimumLedgerVersion !== undefined) {
|
|
18
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
19
|
+
|
|
20
|
+
// Collect all of the promises to wait at the same time
|
|
21
|
+
// TODO(greg): This needs to be refactored to be handled at the query time. It involves rewriting
|
|
22
|
+
// a bunch of the logic for wait for indexer
|
|
23
|
+
const promises: Array<Promise<void>> = [];
|
|
24
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
25
|
+
for (const processorType of args.processorTypes) {
|
|
26
|
+
promises.push(
|
|
27
|
+
waitForIndexer({
|
|
28
|
+
aptosConfig: args.config,
|
|
29
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
30
|
+
processorType,
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await Promise.all(promises);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/bcs/deserializer.ts
CHANGED
|
@@ -222,10 +222,10 @@ export class Deserializer {
|
|
|
222
222
|
* @example
|
|
223
223
|
* // serialize a vector of addresses
|
|
224
224
|
* const addresses = new Array<AccountAddress>(
|
|
225
|
-
* AccountAddress.
|
|
226
|
-
* AccountAddress.
|
|
227
|
-
* AccountAddress.
|
|
228
|
-
* AccountAddress.
|
|
225
|
+
* AccountAddress.from("0x1"),
|
|
226
|
+
* AccountAddress.from("0x2"),
|
|
227
|
+
* AccountAddress.from("0xa"),
|
|
228
|
+
* AccountAddress.from("0xb"),
|
|
229
229
|
* );
|
|
230
230
|
* const serializer = new Serializer();
|
|
231
231
|
* serializer.serializeVector(addresses);
|
package/src/bcs/serializer.ts
CHANGED
|
@@ -298,10 +298,10 @@ export class Serializer {
|
|
|
298
298
|
* @param values The array of BCS Serializable values
|
|
299
299
|
* @example
|
|
300
300
|
* const addresses = new Array<AccountAddress>(
|
|
301
|
-
* AccountAddress.
|
|
302
|
-
* AccountAddress.
|
|
303
|
-
* AccountAddress.
|
|
304
|
-
* AccountAddress.
|
|
301
|
+
* AccountAddress.from("0x1"),
|
|
302
|
+
* AccountAddress.from("0x2"),
|
|
303
|
+
* AccountAddress.from("0xa"),
|
|
304
|
+
* AccountAddress.from("0xb"),
|
|
305
305
|
* );
|
|
306
306
|
* const serializer = new Serializer();
|
|
307
307
|
* serializer.serializeVector(addresses);
|