@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/internal/event.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core";
|
|
13
|
-
import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId,
|
|
13
|
+
import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderByArg, WhereArg } from "../types";
|
|
14
14
|
import { GetEventsQuery } from "../types/generated/operations";
|
|
15
15
|
import { GetEvents } from "../types/generated/queries";
|
|
16
16
|
import { EventsBoolExp } from "../types/generated/types";
|
|
@@ -36,13 +36,10 @@ export async function getAccountEventsByEventType(args: {
|
|
|
36
36
|
aptosConfig: AptosConfig;
|
|
37
37
|
accountAddress: AccountAddressInput;
|
|
38
38
|
eventType: MoveStructId;
|
|
39
|
-
options?:
|
|
40
|
-
pagination?: PaginationArgs;
|
|
41
|
-
orderBy?: OrderBy<GetEventsResponse[0]>;
|
|
42
|
-
};
|
|
39
|
+
options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
|
|
43
40
|
}): Promise<GetEventsResponse> {
|
|
44
41
|
const { accountAddress, aptosConfig, eventType, options } = args;
|
|
45
|
-
const address = AccountAddress.
|
|
42
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
46
43
|
|
|
47
44
|
const whereCondition: EventsBoolExp = {
|
|
48
45
|
account_address: { _eq: address },
|
|
@@ -51,7 +48,7 @@ export async function getAccountEventsByEventType(args: {
|
|
|
51
48
|
|
|
52
49
|
const customOptions = {
|
|
53
50
|
where: whereCondition,
|
|
54
|
-
pagination: options
|
|
51
|
+
pagination: options,
|
|
55
52
|
orderBy: options?.orderBy,
|
|
56
53
|
};
|
|
57
54
|
|
|
@@ -60,11 +57,7 @@ export async function getAccountEventsByEventType(args: {
|
|
|
60
57
|
|
|
61
58
|
export async function getEvents(args: {
|
|
62
59
|
aptosConfig: AptosConfig;
|
|
63
|
-
options?:
|
|
64
|
-
where?: EventsBoolExp;
|
|
65
|
-
pagination?: PaginationArgs;
|
|
66
|
-
orderBy?: OrderBy<GetEventsResponse[0]>;
|
|
67
|
-
};
|
|
60
|
+
options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;
|
|
68
61
|
}): Promise<GetEventsResponse> {
|
|
69
62
|
const { aptosConfig, options } = args;
|
|
70
63
|
|
|
@@ -72,8 +65,8 @@ export async function getEvents(args: {
|
|
|
72
65
|
query: GetEvents,
|
|
73
66
|
variables: {
|
|
74
67
|
where_condition: options?.where,
|
|
75
|
-
offset: options?.
|
|
76
|
-
limit: options?.
|
|
68
|
+
offset: options?.offset,
|
|
69
|
+
limit: options?.limit,
|
|
77
70
|
order_by: options?.orderBy,
|
|
78
71
|
},
|
|
79
72
|
};
|
package/src/internal/faucet.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { postAptosFaucet } from "../client";
|
|
13
13
|
import { AccountAddress, AccountAddressInput } from "../core";
|
|
14
|
-
import { WaitForTransactionOptions } from "../types";
|
|
14
|
+
import { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from "../types";
|
|
15
15
|
import { DEFAULT_TXN_TIMEOUT_SEC } from "../utils/const";
|
|
16
16
|
import { waitForTransaction } from "./transaction";
|
|
17
17
|
|
|
@@ -20,14 +20,14 @@ export async function fundAccount(args: {
|
|
|
20
20
|
accountAddress: AccountAddressInput;
|
|
21
21
|
amount: number;
|
|
22
22
|
options?: WaitForTransactionOptions;
|
|
23
|
-
}): Promise<
|
|
23
|
+
}): Promise<UserTransactionResponse> {
|
|
24
24
|
const { aptosConfig, accountAddress, amount, options } = args;
|
|
25
25
|
const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;
|
|
26
26
|
const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({
|
|
27
27
|
aptosConfig,
|
|
28
28
|
path: "fund",
|
|
29
29
|
body: {
|
|
30
|
-
address: AccountAddress.
|
|
30
|
+
address: AccountAddress.from(accountAddress).toString(),
|
|
31
31
|
amount,
|
|
32
32
|
},
|
|
33
33
|
originMethod: "fundAccount",
|
|
@@ -35,15 +35,19 @@ export async function fundAccount(args: {
|
|
|
35
35
|
|
|
36
36
|
const txnHash = data.txn_hashes[0];
|
|
37
37
|
|
|
38
|
-
await waitForTransaction({
|
|
38
|
+
const res = await waitForTransaction({
|
|
39
39
|
aptosConfig,
|
|
40
40
|
transactionHash: txnHash,
|
|
41
41
|
options: {
|
|
42
42
|
timeoutSecs: timeout,
|
|
43
43
|
checkSuccess: options?.checkSuccess,
|
|
44
|
-
indexerVersionCheck: options?.indexerVersionCheck,
|
|
45
44
|
},
|
|
46
45
|
});
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
// Response is always User transaction for a user submitted transaction
|
|
48
|
+
if (res.type === TransactionResponseType.User) {
|
|
49
|
+
return res;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw new Error(`Unexpected transaction received for fund account: ${res.type}`);
|
|
49
53
|
}
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import {
|
|
13
|
+
AnyNumber,
|
|
13
14
|
GetCurrentFungibleAssetBalancesResponse,
|
|
14
15
|
GetFungibleAssetActivitiesResponse,
|
|
15
16
|
GetFungibleAssetMetadataResponse,
|
|
16
17
|
PaginationArgs,
|
|
18
|
+
WhereArg,
|
|
17
19
|
} from "../types";
|
|
18
20
|
import { queryIndexer } from "./general";
|
|
19
21
|
import {
|
|
@@ -31,13 +33,13 @@ import {
|
|
|
31
33
|
FungibleAssetActivitiesBoolExp,
|
|
32
34
|
FungibleAssetMetadataBoolExp,
|
|
33
35
|
} from "../types/generated/types";
|
|
36
|
+
import { Account, AccountAddress } from "../core";
|
|
37
|
+
import { InputGenerateTransactionOptions } from "../transactions";
|
|
38
|
+
import { generateTransaction } from "./transactionSubmission";
|
|
34
39
|
|
|
35
40
|
export async function getFungibleAssetMetadata(args: {
|
|
36
41
|
aptosConfig: AptosConfig;
|
|
37
|
-
options?:
|
|
38
|
-
pagination?: PaginationArgs;
|
|
39
|
-
where?: FungibleAssetMetadataBoolExp;
|
|
40
|
-
};
|
|
42
|
+
options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;
|
|
41
43
|
}): Promise<GetFungibleAssetMetadataResponse> {
|
|
42
44
|
const { aptosConfig, options } = args;
|
|
43
45
|
|
|
@@ -45,8 +47,8 @@ export async function getFungibleAssetMetadata(args: {
|
|
|
45
47
|
query: GetFungibleAssetMetadata,
|
|
46
48
|
variables: {
|
|
47
49
|
where_condition: options?.where,
|
|
48
|
-
limit: options?.
|
|
49
|
-
offset: options?.
|
|
50
|
+
limit: options?.limit,
|
|
51
|
+
offset: options?.offset,
|
|
50
52
|
},
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -61,10 +63,7 @@ export async function getFungibleAssetMetadata(args: {
|
|
|
61
63
|
|
|
62
64
|
export async function getFungibleAssetActivities(args: {
|
|
63
65
|
aptosConfig: AptosConfig;
|
|
64
|
-
options?:
|
|
65
|
-
pagination?: PaginationArgs;
|
|
66
|
-
where?: FungibleAssetActivitiesBoolExp;
|
|
67
|
-
};
|
|
66
|
+
options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;
|
|
68
67
|
}): Promise<GetFungibleAssetActivitiesResponse> {
|
|
69
68
|
const { aptosConfig, options } = args;
|
|
70
69
|
|
|
@@ -72,8 +71,8 @@ export async function getFungibleAssetActivities(args: {
|
|
|
72
71
|
query: GetFungibleAssetActivities,
|
|
73
72
|
variables: {
|
|
74
73
|
where_condition: options?.where,
|
|
75
|
-
limit: options?.
|
|
76
|
-
offset: options?.
|
|
74
|
+
limit: options?.limit,
|
|
75
|
+
offset: options?.offset,
|
|
77
76
|
},
|
|
78
77
|
};
|
|
79
78
|
|
|
@@ -88,10 +87,7 @@ export async function getFungibleAssetActivities(args: {
|
|
|
88
87
|
|
|
89
88
|
export async function getCurrentFungibleAssetBalances(args: {
|
|
90
89
|
aptosConfig: AptosConfig;
|
|
91
|
-
options?:
|
|
92
|
-
pagination?: PaginationArgs;
|
|
93
|
-
where?: CurrentFungibleAssetBalancesBoolExp;
|
|
94
|
-
};
|
|
90
|
+
options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
|
|
95
91
|
}): Promise<GetCurrentFungibleAssetBalancesResponse> {
|
|
96
92
|
const { aptosConfig, options } = args;
|
|
97
93
|
|
|
@@ -99,8 +95,8 @@ export async function getCurrentFungibleAssetBalances(args: {
|
|
|
99
95
|
query: GetCurrentFungibleAssetBalances,
|
|
100
96
|
variables: {
|
|
101
97
|
where_condition: options?.where,
|
|
102
|
-
limit: options?.
|
|
103
|
-
offset: options?.
|
|
98
|
+
limit: options?.limit,
|
|
99
|
+
offset: options?.offset,
|
|
104
100
|
},
|
|
105
101
|
};
|
|
106
102
|
|
|
@@ -112,3 +108,25 @@ export async function getCurrentFungibleAssetBalances(args: {
|
|
|
112
108
|
|
|
113
109
|
return data.current_fungible_asset_balances;
|
|
114
110
|
}
|
|
111
|
+
|
|
112
|
+
export async function transferFungibleAsset(args: {
|
|
113
|
+
aptosConfig: AptosConfig;
|
|
114
|
+
sender: Account;
|
|
115
|
+
fungibleAssetMetadataAddress: AccountAddress;
|
|
116
|
+
recipient: AccountAddress;
|
|
117
|
+
amount: AnyNumber;
|
|
118
|
+
options?: InputGenerateTransactionOptions;
|
|
119
|
+
}) {
|
|
120
|
+
const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;
|
|
121
|
+
const transaction = await generateTransaction({
|
|
122
|
+
aptosConfig,
|
|
123
|
+
sender: sender.accountAddress,
|
|
124
|
+
data: {
|
|
125
|
+
function: "0x1::primary_fungible_store::transfer",
|
|
126
|
+
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
127
|
+
functionArguments: [fungibleAssetMetadataAddress, recipient, amount],
|
|
128
|
+
},
|
|
129
|
+
options,
|
|
130
|
+
});
|
|
131
|
+
return transaction;
|
|
132
|
+
}
|
package/src/internal/general.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
GetProcessorStatusResponse,
|
|
18
18
|
GraphqlQuery,
|
|
19
19
|
LedgerInfo,
|
|
20
|
-
|
|
20
|
+
LedgerVersionArg,
|
|
21
21
|
MoveValue,
|
|
22
22
|
TableItemRequest,
|
|
23
23
|
ViewRequest,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
} from "../types";
|
|
26
26
|
import { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from "../types/generated/operations";
|
|
27
27
|
import { GetChainTopUserTransactions, GetProcessorStatus } from "../types/generated/queries";
|
|
28
|
+
import { ProcessorType } from "../utils/const";
|
|
28
29
|
|
|
29
30
|
export async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise<LedgerInfo> {
|
|
30
31
|
const { aptosConfig } = args;
|
|
@@ -70,7 +71,7 @@ export async function getTableItem<T>(args: {
|
|
|
70
71
|
aptosConfig: AptosConfig;
|
|
71
72
|
handle: string;
|
|
72
73
|
data: TableItemRequest;
|
|
73
|
-
options?:
|
|
74
|
+
options?: LedgerVersionArg;
|
|
74
75
|
}): Promise<T> {
|
|
75
76
|
const { aptosConfig, handle, data, options } = args;
|
|
76
77
|
const response = await postAptosFullNode<TableItemRequest, any>({
|
|
@@ -86,7 +87,7 @@ export async function getTableItem<T>(args: {
|
|
|
86
87
|
export async function view<T extends Array<MoveValue> = Array<MoveValue>>(args: {
|
|
87
88
|
aptosConfig: AptosConfig;
|
|
88
89
|
payload: InputViewRequestData;
|
|
89
|
-
options?:
|
|
90
|
+
options?: LedgerVersionArg;
|
|
90
91
|
}): Promise<T> {
|
|
91
92
|
const { aptosConfig, payload, options } = args;
|
|
92
93
|
const { data } = await postAptosFullNode<ViewRequest, MoveValue[]>({
|
|
@@ -159,3 +160,29 @@ export async function getIndexerLastSuccessVersion(args: { aptosConfig: AptosCon
|
|
|
159
160
|
const response = await getProcessorStatuses({ aptosConfig: args.aptosConfig });
|
|
160
161
|
return response[0].last_success_version;
|
|
161
162
|
}
|
|
163
|
+
|
|
164
|
+
export async function getProcessorStatus(args: {
|
|
165
|
+
aptosConfig: AptosConfig;
|
|
166
|
+
processorType: ProcessorType;
|
|
167
|
+
}): Promise<GetProcessorStatusResponse[0]> {
|
|
168
|
+
const { aptosConfig, processorType } = args;
|
|
169
|
+
|
|
170
|
+
const whereCondition: { processor: { _eq: string } } = {
|
|
171
|
+
processor: { _eq: processorType.valueOf() },
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const graphqlQuery = {
|
|
175
|
+
query: GetProcessorStatus,
|
|
176
|
+
variables: {
|
|
177
|
+
where_condition: whereCondition,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const data = await queryIndexer<GetProcessorStatusQuery>({
|
|
182
|
+
aptosConfig,
|
|
183
|
+
query: graphqlQuery,
|
|
184
|
+
originMethod: "getProcessorStatus",
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return data.processor_status[0];
|
|
188
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import "./AnsTokenFragment";
|
|
2
|
+
query getNames(
|
|
3
|
+
$offset: Int
|
|
4
|
+
$limit: Int
|
|
5
|
+
$where_condition: current_aptos_names_bool_exp
|
|
6
|
+
$order_by: [current_aptos_names_order_by!]
|
|
7
|
+
) {
|
|
8
|
+
current_aptos_names(limit: $limit, where: $where_condition, order_by: $order_by, offset: $offset) {
|
|
9
|
+
...AnsTokenFragment
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
query getNumberOfDelegators(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
) {
|
|
1
|
+
query getNumberOfDelegators(
|
|
2
|
+
$where_condition: num_active_delegator_per_pool_bool_exp
|
|
3
|
+
$order_by: [num_active_delegator_per_pool_order_by!]
|
|
4
|
+
) {
|
|
5
|
+
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
6
6
|
num_active_delegator
|
|
7
7
|
pool_address
|
|
8
8
|
}
|
package/src/internal/staking.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core";
|
|
13
|
-
import { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse,
|
|
13
|
+
import { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from "../types";
|
|
14
14
|
import { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from "../types/generated/operations";
|
|
15
15
|
import { GetDelegatedStakingActivities, GetNumberOfDelegators } from "../types/generated/queries";
|
|
16
16
|
import { queryIndexer } from "./general";
|
|
@@ -20,30 +20,28 @@ export async function getNumberOfDelegators(args: {
|
|
|
20
20
|
poolAddress: AccountAddressInput;
|
|
21
21
|
}): Promise<number> {
|
|
22
22
|
const { aptosConfig, poolAddress } = args;
|
|
23
|
-
const address = AccountAddress.
|
|
23
|
+
const address = AccountAddress.from(poolAddress).toStringLong();
|
|
24
24
|
const query = {
|
|
25
25
|
query: GetNumberOfDelegators,
|
|
26
26
|
variables: { where_condition: { pool_address: { _eq: address } } },
|
|
27
27
|
};
|
|
28
|
-
const data
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return data.num_active_delegator_per_pool[0].num_active_delegator;
|
|
28
|
+
const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });
|
|
29
|
+
|
|
30
|
+
// commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason
|
|
31
|
+
// might be because of how ts infer the graphql generated scheme type
|
|
32
|
+
return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export async function getNumberOfDelegatorsForAllPools(args: {
|
|
36
36
|
aptosConfig: AptosConfig;
|
|
37
|
-
options?:
|
|
38
|
-
orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;
|
|
39
|
-
};
|
|
37
|
+
options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;
|
|
40
38
|
}): Promise<GetNumberOfDelegatorsResponse> {
|
|
41
39
|
const { aptosConfig, options } = args;
|
|
42
40
|
const query = {
|
|
43
41
|
query: GetNumberOfDelegators,
|
|
44
|
-
variables: {
|
|
42
|
+
variables: { order_by: options?.orderBy },
|
|
45
43
|
};
|
|
46
|
-
const data
|
|
44
|
+
const data = await queryIndexer<GetNumberOfDelegatorsQuery>({
|
|
47
45
|
aptosConfig,
|
|
48
46
|
query,
|
|
49
47
|
});
|
|
@@ -59,8 +57,8 @@ export async function getDelegatedStakingActivities(args: {
|
|
|
59
57
|
const query = {
|
|
60
58
|
query: GetDelegatedStakingActivities,
|
|
61
59
|
variables: {
|
|
62
|
-
delegatorAddress: AccountAddress.
|
|
63
|
-
poolAddress: AccountAddress.
|
|
60
|
+
delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),
|
|
61
|
+
poolAddress: AccountAddress.from(poolAddress).toStringLong(),
|
|
64
62
|
},
|
|
65
63
|
};
|
|
66
64
|
const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
type PaginationArgs,
|
|
19
19
|
type TransactionResponse,
|
|
20
20
|
WaitForTransactionOptions,
|
|
21
|
+
CommittedTransactionResponse,
|
|
21
22
|
} from "../types";
|
|
22
|
-
import { DEFAULT_TXN_TIMEOUT_SEC } from "../utils/const";
|
|
23
|
+
import { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from "../utils/const";
|
|
23
24
|
import { sleep } from "../utils/helpers";
|
|
24
25
|
import { memoizeAsync } from "../utils/memoize";
|
|
25
|
-
import { getIndexerLastSuccessVersion } from "./general";
|
|
26
|
+
import { getIndexerLastSuccessVersion, getProcessorStatus } from "./general";
|
|
26
27
|
|
|
27
28
|
export async function getTransactions(args: {
|
|
28
29
|
aptosConfig: AptosConfig;
|
|
@@ -100,11 +101,10 @@ export async function waitForTransaction(args: {
|
|
|
100
101
|
aptosConfig: AptosConfig;
|
|
101
102
|
transactionHash: HexInput;
|
|
102
103
|
options?: WaitForTransactionOptions;
|
|
103
|
-
}): Promise<
|
|
104
|
+
}): Promise<CommittedTransactionResponse> {
|
|
104
105
|
const { aptosConfig, transactionHash, options } = args;
|
|
105
106
|
const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;
|
|
106
107
|
const checkSuccess = options?.checkSuccess ?? true;
|
|
107
|
-
const indexerVersionCheck = options?.indexerVersionCheck ?? true;
|
|
108
108
|
|
|
109
109
|
let isPending = true;
|
|
110
110
|
let timeElapsed = 0;
|
|
@@ -167,49 +167,46 @@ export async function waitForTransaction(args: {
|
|
|
167
167
|
}
|
|
168
168
|
if (!lastTxn.success) {
|
|
169
169
|
throw new FailedTransactionError(
|
|
170
|
-
`Transaction ${transactionHash} failed with an error: ${
|
|
170
|
+
`Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,
|
|
171
171
|
lastTxn,
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
// Make sure indexer is synced with the latest ledger version
|
|
176
|
-
if (indexerVersionCheck) {
|
|
177
|
-
try {
|
|
178
|
-
await waitForLastSuccessIndexerVersionSync({ aptosConfig, ledgerVersion: Number(lastTxn.version) });
|
|
179
|
-
} catch (_e) {
|
|
180
|
-
throw new WaitForTransactionError(
|
|
181
|
-
// eslint-disable-next-line max-len
|
|
182
|
-
`Transaction ${transactionHash} committed, but timed out waiting for indexer to sync with ledger version ${lastTxn.version}.` +
|
|
183
|
-
"You can disable this check by setting `indexerVersionCheck` to false in the `extraArgs` parameter.",
|
|
184
|
-
lastTxn,
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
175
|
return lastTxn;
|
|
190
176
|
}
|
|
191
177
|
|
|
192
178
|
/**
|
|
193
179
|
* Waits for the indexer to sync up to the ledgerVersion. Timeout is 3 seconds.
|
|
194
180
|
*/
|
|
195
|
-
async function
|
|
181
|
+
export async function waitForIndexer(args: {
|
|
196
182
|
aptosConfig: AptosConfig;
|
|
197
|
-
|
|
183
|
+
minimumLedgerVersion: AnyNumber;
|
|
184
|
+
processorType?: ProcessorType;
|
|
198
185
|
}): Promise<void> {
|
|
199
|
-
const { aptosConfig,
|
|
186
|
+
const { aptosConfig, processorType } = args;
|
|
187
|
+
const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);
|
|
200
188
|
const timeoutMilliseconds = 3000; // 3 seconds
|
|
201
189
|
const startTime = new Date().getTime();
|
|
202
190
|
let indexerVersion = -1;
|
|
203
191
|
|
|
204
|
-
while (indexerVersion <
|
|
192
|
+
while (indexerVersion < minimumLedgerVersion) {
|
|
205
193
|
// check for timeout
|
|
206
194
|
if (new Date().getTime() - startTime > timeoutMilliseconds) {
|
|
207
195
|
throw new Error("waitForLastSuccessIndexerVersionSync timeout");
|
|
208
196
|
}
|
|
209
197
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
198
|
+
if (processorType === undefined) {
|
|
199
|
+
// Get the last success version from all processor
|
|
200
|
+
// eslint-disable-next-line no-await-in-loop
|
|
201
|
+
indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });
|
|
202
|
+
} else {
|
|
203
|
+
// Get the last success version from the specific processor
|
|
204
|
+
// eslint-disable-next-line no-await-in-loop
|
|
205
|
+
const processor = await getProcessorStatus({ aptosConfig, processorType });
|
|
206
|
+
indexerVersion = processor.last_success_version;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (indexerVersion >= minimumLedgerVersion) {
|
|
213
210
|
// break out immediately if we are synced
|
|
214
211
|
break;
|
|
215
212
|
}
|
|
@@ -19,21 +19,36 @@ import {
|
|
|
19
19
|
generateSignedTransactionForSimulation,
|
|
20
20
|
generateSignedTransaction,
|
|
21
21
|
sign,
|
|
22
|
+
generateSigningMessage,
|
|
22
23
|
} from "../transactions/transactionBuilder/transactionBuilder";
|
|
23
24
|
import {
|
|
24
25
|
InputGenerateTransactionData,
|
|
25
26
|
AnyRawTransaction,
|
|
26
27
|
InputSimulateTransactionData,
|
|
27
28
|
InputGenerateTransactionOptions,
|
|
28
|
-
|
|
29
|
+
SingleSignerTransaction,
|
|
29
30
|
InputGenerateTransactionPayloadDataWithRemoteABI,
|
|
30
31
|
InputSubmitTransactionData,
|
|
31
|
-
InputGenerateFeePayerRawTransactionData,
|
|
32
32
|
InputGenerateMultiAgentRawTransactionData,
|
|
33
|
+
InputGenerateSingleSignerRawTransactionData,
|
|
34
|
+
MultiAgentTransaction,
|
|
35
|
+
AnyTransactionPayloadInstance,
|
|
33
36
|
} from "../transactions/types";
|
|
34
37
|
import { getInfo } from "./account";
|
|
35
38
|
import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from "../types";
|
|
36
39
|
|
|
40
|
+
/**
|
|
41
|
+
* We are defining function signatures, each with its specific input and output.
|
|
42
|
+
* These are the possible function signature for `generateTransaction` function.
|
|
43
|
+
* When we call `generateTransaction` function with the relevant type properties,
|
|
44
|
+
* Typescript can infer the return type based on the appropriate function overload.
|
|
45
|
+
*/
|
|
46
|
+
export async function generateTransaction(
|
|
47
|
+
args: { aptosConfig: AptosConfig } & InputGenerateSingleSignerRawTransactionData,
|
|
48
|
+
): Promise<SingleSignerTransaction>;
|
|
49
|
+
export async function generateTransaction(
|
|
50
|
+
args: { aptosConfig: AptosConfig } & InputGenerateMultiAgentRawTransactionData,
|
|
51
|
+
): Promise<MultiAgentTransaction>;
|
|
37
52
|
/**
|
|
38
53
|
* Generates any transaction by passing in the required arguments
|
|
39
54
|
*
|
|
@@ -77,12 +92,21 @@ import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput
|
|
|
77
92
|
export async function generateTransaction(
|
|
78
93
|
args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
|
|
79
94
|
): Promise<AnyRawTransaction> {
|
|
80
|
-
const
|
|
95
|
+
const payload = await buildTransactionPayload(args);
|
|
96
|
+
return buildRawTransaction(args, payload);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function buildTransactionPayload(
|
|
100
|
+
args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
|
|
101
|
+
): Promise<AnyTransactionPayloadInstance> {
|
|
102
|
+
const { aptosConfig, data } = args;
|
|
81
103
|
|
|
82
104
|
// Merge in aptosConfig for remote ABI on non-script payloads
|
|
83
105
|
let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;
|
|
106
|
+
let payload: AnyTransactionPayloadInstance;
|
|
84
107
|
if ("bytecode" in data) {
|
|
85
108
|
generateTransactionPayloadData = data;
|
|
109
|
+
payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
86
110
|
} else if ("multisigAddress" in data) {
|
|
87
111
|
generateTransactionPayloadData = {
|
|
88
112
|
aptosConfig,
|
|
@@ -91,6 +115,7 @@ export async function generateTransaction(
|
|
|
91
115
|
functionArguments: data.functionArguments,
|
|
92
116
|
typeArguments: data.typeArguments,
|
|
93
117
|
};
|
|
118
|
+
payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
94
119
|
} else {
|
|
95
120
|
generateTransactionPayloadData = {
|
|
96
121
|
aptosConfig,
|
|
@@ -98,46 +123,45 @@ export async function generateTransaction(
|
|
|
98
123
|
functionArguments: data.functionArguments,
|
|
99
124
|
typeArguments: data.typeArguments,
|
|
100
125
|
};
|
|
126
|
+
payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
101
127
|
}
|
|
128
|
+
return payload;
|
|
129
|
+
}
|
|
102
130
|
|
|
131
|
+
export async function buildRawTransaction(
|
|
132
|
+
args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
|
|
133
|
+
payload: AnyTransactionPayloadInstance,
|
|
134
|
+
): Promise<AnyRawTransaction> {
|
|
135
|
+
const { aptosConfig, sender, options } = args;
|
|
136
|
+
|
|
137
|
+
let feePayerAddress;
|
|
103
138
|
if (isFeePayerTransactionInput(args)) {
|
|
104
|
-
|
|
105
|
-
const feePayerAddress = args.hasFeePayer ? AccountAddress.ZERO : undefined;
|
|
106
|
-
const payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
107
|
-
return buildTransaction({
|
|
108
|
-
aptosConfig,
|
|
109
|
-
sender,
|
|
110
|
-
payload,
|
|
111
|
-
options,
|
|
112
|
-
secondarySignerAddresses,
|
|
113
|
-
feePayerAddress,
|
|
114
|
-
});
|
|
139
|
+
feePayerAddress = AccountAddress.ZERO.toString();
|
|
115
140
|
}
|
|
141
|
+
|
|
116
142
|
if (isMultiAgentTransactionInput(args)) {
|
|
117
143
|
const { secondarySignerAddresses } = args;
|
|
118
|
-
const payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
119
144
|
return buildTransaction({
|
|
120
145
|
aptosConfig,
|
|
121
146
|
sender,
|
|
122
147
|
payload,
|
|
123
148
|
options,
|
|
124
149
|
secondarySignerAddresses,
|
|
150
|
+
feePayerAddress,
|
|
125
151
|
});
|
|
126
152
|
}
|
|
127
153
|
|
|
128
|
-
const payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
129
154
|
return buildTransaction({
|
|
130
155
|
aptosConfig,
|
|
131
156
|
sender,
|
|
132
157
|
payload,
|
|
133
158
|
options,
|
|
159
|
+
feePayerAddress,
|
|
134
160
|
});
|
|
135
161
|
}
|
|
136
162
|
|
|
137
|
-
function isFeePayerTransactionInput(
|
|
138
|
-
data
|
|
139
|
-
): data is InputGenerateFeePayerRawTransactionData {
|
|
140
|
-
return "hasFeePayer" in data;
|
|
163
|
+
function isFeePayerTransactionInput(data: InputGenerateTransactionData): boolean {
|
|
164
|
+
return data.withFeePayer === true;
|
|
141
165
|
}
|
|
142
166
|
|
|
143
167
|
function isMultiAgentTransactionInput(
|
|
@@ -146,6 +170,20 @@ function isMultiAgentTransactionInput(
|
|
|
146
170
|
return "secondarySignerAddresses" in data;
|
|
147
171
|
}
|
|
148
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Builds a signing message that can be signed by external signers
|
|
175
|
+
*
|
|
176
|
+
* Note: Please prefer using `signTransaction` unless signing outside the SDK
|
|
177
|
+
*
|
|
178
|
+
* @param args.transaction AnyRawTransaction, as generated by `generateTransaction()`
|
|
179
|
+
*
|
|
180
|
+
* @return The message to be signed
|
|
181
|
+
*/
|
|
182
|
+
export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {
|
|
183
|
+
const { transaction } = args;
|
|
184
|
+
return generateSigningMessage(transaction);
|
|
185
|
+
}
|
|
186
|
+
|
|
149
187
|
/**
|
|
150
188
|
* Sign a transaction that can later be submitted to chain
|
|
151
189
|
*
|
|
@@ -249,21 +287,21 @@ export async function publicPackageTransaction(args: {
|
|
|
249
287
|
metadataBytes: HexInput;
|
|
250
288
|
moduleBytecode: Array<HexInput>;
|
|
251
289
|
options?: InputGenerateTransactionOptions;
|
|
252
|
-
}): Promise<
|
|
290
|
+
}): Promise<SingleSignerTransaction> {
|
|
253
291
|
const { aptosConfig, account, metadataBytes, moduleBytecode, options } = args;
|
|
254
292
|
|
|
255
293
|
const totalByteCode = moduleBytecode.map((bytecode) => MoveVector.U8(bytecode));
|
|
256
294
|
|
|
257
295
|
const transaction = await generateTransaction({
|
|
258
296
|
aptosConfig,
|
|
259
|
-
sender: AccountAddress.
|
|
297
|
+
sender: AccountAddress.from(account),
|
|
260
298
|
data: {
|
|
261
299
|
function: "0x1::code::publish_package_txn",
|
|
262
300
|
functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],
|
|
263
301
|
},
|
|
264
302
|
options,
|
|
265
303
|
});
|
|
266
|
-
return transaction
|
|
304
|
+
return transaction;
|
|
267
305
|
}
|
|
268
306
|
|
|
269
307
|
/**
|
|
@@ -277,7 +315,7 @@ export async function rotateAuthKey(args: {
|
|
|
277
315
|
const { aptosConfig, fromAccount, toNewPrivateKey } = args;
|
|
278
316
|
const accountInfo = await getInfo({
|
|
279
317
|
aptosConfig,
|
|
280
|
-
accountAddress: fromAccount.accountAddress
|
|
318
|
+
accountAddress: fromAccount.accountAddress,
|
|
281
319
|
});
|
|
282
320
|
|
|
283
321
|
const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });
|
|
@@ -297,7 +335,7 @@ export async function rotateAuthKey(args: {
|
|
|
297
335
|
// Generate transaction
|
|
298
336
|
const rawTxn = await generateTransaction({
|
|
299
337
|
aptosConfig,
|
|
300
|
-
sender: fromAccount.accountAddress
|
|
338
|
+
sender: fromAccount.accountAddress,
|
|
301
339
|
data: {
|
|
302
340
|
function: "0x1::account::rotate_authentication_key",
|
|
303
341
|
functionArguments: [
|