@aptos-labs/ts-sdk 0.0.7 → 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 +17 -1
- package/dist/browser/index.d.ts +798 -446
- package/dist/browser/index.global.js +30 -30
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +798 -446
- package/dist/common/index.js +29 -29
- 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 +19 -17
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +1 -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 +4 -3
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +21 -18
- 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 +1 -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 +1 -0
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/transactionSubmission.d.mts +23 -1
- 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/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-3732I6BR.mjs → chunk-2YQXX64E.mjs} +2 -2
- 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-72F5YXGC.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-UDBH4CER.mjs → chunk-BQSE5HHW.mjs} +7 -7
- 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-5LO7FR2P.mjs → chunk-EFRFDFS4.mjs} +2 -2
- 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-TPWSHFFI.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-ND3ZQKTT.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-DRPMIJH7.mjs → chunk-P5747ZYC.mjs} +2 -2
- package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-PL2VA73L.mjs} +2 -2
- package/dist/esm/chunk-PXTMLJKO.mjs +2 -0
- package/dist/esm/{chunk-WL4OXZLN.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-HO7K2UAK.mjs → chunk-RCM3K5JL.mjs} +2 -2
- package/dist/esm/{chunk-3VZ3OZKC.mjs → chunk-RLG3WOTH.mjs} +2 -2
- 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-GAI75GOG.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-ZUHN56GM.mjs → chunk-UWXDXOFK.mjs} +2 -2
- 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-IBH7IOIM.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-4KTQIWUP.mjs → chunk-ZFK7QD3B.mjs} +2 -2
- 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 +11 -8
- 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 +7 -10
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +4 -3
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +9 -18
- 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 +5 -5
- 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 +5 -7
- 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 +24 -5
- 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 +4 -3
- 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 +3 -2
- 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 +3 -2
- package/dist/esm/types/generated/operations.d.mts +3 -3
- package/dist/esm/types/generated/queries.d.mts +3 -3
- 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/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 +19 -22
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/coin.ts +2 -6
- package/src/api/digitalAsset.ts +72 -22
- 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.ts +43 -1
- 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 +52 -39
- package/src/internal/coin.ts +4 -6
- package/src/internal/digitalAsset.ts +12 -22
- 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/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 +35 -5
- 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 +28 -26
- package/src/transactions/typeTag/parser.ts +1 -1
- package/src/transactions/types.ts +2 -2
- package/src/types/generated/operations.ts +4 -2
- package/src/types/generated/queries.ts +4 -4
- package/src/types/index.ts +67 -11
- package/src/utils/const.ts +18 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2OZRBXLM.mjs +0 -2
- package/dist/esm/chunk-2OZRBXLM.mjs.map +0 -1
- package/dist/esm/chunk-33T7WTB6.mjs +0 -2
- package/dist/esm/chunk-33T7WTB6.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-67OGU66P.mjs +0 -2
- package/dist/esm/chunk-67OGU66P.mjs.map +0 -1
- package/dist/esm/chunk-72F5YXGC.mjs.map +0 -1
- package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
- package/dist/esm/chunk-BFQRMCY2.mjs +0 -2
- package/dist/esm/chunk-BFQRMCY2.mjs.map +0 -1
- package/dist/esm/chunk-BM4HBROC.mjs +0 -2
- package/dist/esm/chunk-BM4HBROC.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-EFIYW4WK.mjs +0 -2
- package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
- package/dist/esm/chunk-GU4OUKAF.mjs +0 -2
- package/dist/esm/chunk-GU4OUKAF.mjs.map +0 -1
- package/dist/esm/chunk-J5BH7V37.mjs +0 -2
- package/dist/esm/chunk-J5BH7V37.mjs.map +0 -1
- package/dist/esm/chunk-KC64ESLO.mjs +0 -2
- package/dist/esm/chunk-L7AA75WZ.mjs +0 -2
- package/dist/esm/chunk-L7AA75WZ.mjs.map +0 -1
- package/dist/esm/chunk-LACQ537H.mjs +0 -2
- package/dist/esm/chunk-LACQ537H.mjs.map +0 -1
- package/dist/esm/chunk-LDAD54H5.mjs +0 -2
- package/dist/esm/chunk-LDAD54H5.mjs.map +0 -1
- package/dist/esm/chunk-LXW3A3MJ.mjs +0 -2
- package/dist/esm/chunk-LXW3A3MJ.mjs.map +0 -1
- package/dist/esm/chunk-M2V2POWK.mjs +0 -2
- package/dist/esm/chunk-M2V2POWK.mjs.map +0 -1
- package/dist/esm/chunk-ND3ZQKTT.mjs +0 -2
- package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
- package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
- package/dist/esm/chunk-O2B54NZT.mjs +0 -2
- package/dist/esm/chunk-O2B54NZT.mjs.map +0 -1
- package/dist/esm/chunk-OCW2L33Q.mjs +0 -2
- package/dist/esm/chunk-OCW2L33Q.mjs.map +0 -1
- package/dist/esm/chunk-OCYS4V2V.mjs +0 -2
- package/dist/esm/chunk-OCYS4V2V.mjs.map +0 -1
- package/dist/esm/chunk-OSTH5JRX.mjs +0 -2
- package/dist/esm/chunk-OSTH5JRX.mjs.map +0 -1
- package/dist/esm/chunk-OVHY6ZUJ.mjs +0 -2
- package/dist/esm/chunk-OVHY6ZUJ.mjs.map +0 -1
- package/dist/esm/chunk-PZCMSHY6.mjs +0 -2
- package/dist/esm/chunk-PZCMSHY6.mjs.map +0 -1
- package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
- package/dist/esm/chunk-RHS5ROLP.mjs +0 -2
- package/dist/esm/chunk-RHS5ROLP.mjs.map +0 -1
- package/dist/esm/chunk-RKKU2SY5.mjs +0 -2
- package/dist/esm/chunk-RKKU2SY5.mjs.map +0 -1
- 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-TGKB6ALT.mjs +0 -2
- package/dist/esm/chunk-TGKB6ALT.mjs.map +0 -1
- package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
- package/dist/esm/chunk-UDBH4CER.mjs.map +0 -1
- package/dist/esm/chunk-WEJAI26R.mjs +0 -2
- package/dist/esm/chunk-WEJAI26R.mjs.map +0 -1
- package/dist/esm/chunk-Y2HRRUZ6.mjs +0 -2
- package/dist/esm/chunk-Y2HRRUZ6.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-ZLW65YCO.mjs +0 -2
- package/dist/esm/chunk-ZLW65YCO.mjs.map +0 -1
- package/dist/esm/chunk-ZUHN56GM.mjs.map +0 -1
- /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/utils.mjs.map} +0 -0
- /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-2SAKPC5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-3732I6BR.mjs.map → chunk-2YQXX64E.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-5LO7FR2P.mjs.map → chunk-EFRFDFS4.mjs.map} +0 -0
- /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-FZ56IS3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-TPWSHFFI.mjs.map → chunk-HC5VMNXA.mjs.map} +0 -0
- /package/dist/esm/{chunk-DRPMIJH7.mjs.map → chunk-P5747ZYC.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-WL4OXZLN.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-HO7K2UAK.mjs.map → chunk-RCM3K5JL.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VZ3OZKC.mjs.map → chunk-RLG3WOTH.mjs.map} +0 -0
- /package/dist/esm/{chunk-GAI75GOG.mjs.map → chunk-SSJQOXEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-IBH7IOIM.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/dist/esm/{chunk-4KTQIWUP.mjs.map → chunk-ZFK7QD3B.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
|
+
}
|
|
@@ -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,6 +19,7 @@ import {
|
|
|
19
19
|
generateSignedTransactionForSimulation,
|
|
20
20
|
generateSignedTransaction,
|
|
21
21
|
sign,
|
|
22
|
+
generateSigningMessage,
|
|
22
23
|
} from "../transactions/transactionBuilder/transactionBuilder";
|
|
23
24
|
import {
|
|
24
25
|
InputGenerateTransactionData,
|
|
@@ -91,7 +92,14 @@ export async function generateTransaction(
|
|
|
91
92
|
export async function generateTransaction(
|
|
92
93
|
args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
|
|
93
94
|
): Promise<AnyRawTransaction> {
|
|
94
|
-
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;
|
|
95
103
|
|
|
96
104
|
// Merge in aptosConfig for remote ABI on non-script payloads
|
|
97
105
|
let generateTransactionPayloadData: InputGenerateTransactionPayloadDataWithRemoteABI;
|
|
@@ -117,6 +125,14 @@ export async function generateTransaction(
|
|
|
117
125
|
};
|
|
118
126
|
payload = await generateTransactionPayload(generateTransactionPayloadData);
|
|
119
127
|
}
|
|
128
|
+
return payload;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function buildRawTransaction(
|
|
132
|
+
args: { aptosConfig: AptosConfig } & InputGenerateTransactionData,
|
|
133
|
+
payload: AnyTransactionPayloadInstance,
|
|
134
|
+
): Promise<AnyRawTransaction> {
|
|
135
|
+
const { aptosConfig, sender, options } = args;
|
|
120
136
|
|
|
121
137
|
let feePayerAddress;
|
|
122
138
|
if (isFeePayerTransactionInput(args)) {
|
|
@@ -154,6 +170,20 @@ function isMultiAgentTransactionInput(
|
|
|
154
170
|
return "secondarySignerAddresses" in data;
|
|
155
171
|
}
|
|
156
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
|
+
|
|
157
187
|
/**
|
|
158
188
|
* Sign a transaction that can later be submitted to chain
|
|
159
189
|
*
|
|
@@ -264,14 +294,14 @@ export async function publicPackageTransaction(args: {
|
|
|
264
294
|
|
|
265
295
|
const transaction = await generateTransaction({
|
|
266
296
|
aptosConfig,
|
|
267
|
-
sender: AccountAddress.
|
|
297
|
+
sender: AccountAddress.from(account),
|
|
268
298
|
data: {
|
|
269
299
|
function: "0x1::code::publish_package_txn",
|
|
270
300
|
functionArguments: [MoveVector.U8(metadataBytes), new MoveVector(totalByteCode)],
|
|
271
301
|
},
|
|
272
302
|
options,
|
|
273
303
|
});
|
|
274
|
-
return transaction
|
|
304
|
+
return transaction;
|
|
275
305
|
}
|
|
276
306
|
|
|
277
307
|
/**
|
|
@@ -285,7 +315,7 @@ export async function rotateAuthKey(args: {
|
|
|
285
315
|
const { aptosConfig, fromAccount, toNewPrivateKey } = args;
|
|
286
316
|
const accountInfo = await getInfo({
|
|
287
317
|
aptosConfig,
|
|
288
|
-
accountAddress: fromAccount.accountAddress
|
|
318
|
+
accountAddress: fromAccount.accountAddress,
|
|
289
319
|
});
|
|
290
320
|
|
|
291
321
|
const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });
|
|
@@ -305,7 +335,7 @@ export async function rotateAuthKey(args: {
|
|
|
305
335
|
// Generate transaction
|
|
306
336
|
const rawTxn = await generateTransaction({
|
|
307
337
|
aptosConfig,
|
|
308
|
-
sender: fromAccount.accountAddress
|
|
338
|
+
sender: fromAccount.accountAddress,
|
|
309
339
|
data: {
|
|
310
340
|
function: "0x1::account::rotate_authentication_key",
|
|
311
341
|
functionArguments: [
|
|
@@ -29,6 +29,22 @@ export abstract class AccountAuthenticator extends Serializable {
|
|
|
29
29
|
throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
isEd25519(): this is AccountAuthenticatorEd25519 {
|
|
34
|
+
return this instanceof AccountAuthenticatorEd25519;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {
|
|
38
|
+
return this instanceof AccountAuthenticatorMultiEd25519;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
isSingleKey(): this is AccountAuthenticatorSingleKey {
|
|
42
|
+
return this instanceof AccountAuthenticatorSingleKey;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
isMultiKey(): this is AccountAuthenticatorMultiKey {
|
|
46
|
+
return this instanceof AccountAuthenticatorMultiKey;
|
|
47
|
+
}
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
/**
|
|
@@ -37,7 +37,7 @@ export class ModuleId extends Serializable {
|
|
|
37
37
|
if (parts.length !== 2) {
|
|
38
38
|
throw new Error("Invalid module id.");
|
|
39
39
|
}
|
|
40
|
-
return new ModuleId(AccountAddress.
|
|
40
|
+
return new ModuleId(AccountAddress.fromString(parts[0]), new Identifier(parts[1]));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
serialize(serializer: Serializer): void {
|