@aptos-labs/ts-sdk 1.12.2 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/chunk-KSEUZTKY.js +2 -0
- package/dist/common/chunk-KSEUZTKY.js.map +1 -0
- package/dist/common/cli/index.d.ts +37 -0
- package/dist/common/cli/index.js +2 -0
- package/dist/common/cli/index.js.map +1 -0
- package/dist/common/index.d.ts +383 -75
- package/dist/common/index.js +25 -25
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-DHqzsb8B.d.mts → Ed25519Account--qjfup2u.d.mts} +1 -1
- package/dist/esm/api/account.d.mts +51 -10
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +10 -18
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +6 -2
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +4 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +8 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +144 -5
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +14 -9
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +3 -0
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +30 -7
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +51 -28
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +2 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.d.mts +11 -2
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +60 -17
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.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.mjs +1 -1
- package/dist/esm/{chunk-3AYBWD76.mjs → chunk-2M6OT6DU.mjs} +2 -2
- package/dist/esm/chunk-2M6OT6DU.mjs.map +1 -0
- package/dist/esm/chunk-3CLYWZYZ.mjs +2 -0
- package/dist/esm/{chunk-C7YANDB2.mjs → chunk-3F6EYD5O.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs → chunk-52C73T26.mjs} +2 -2
- package/dist/esm/{chunk-SOBCWGBM.mjs → chunk-54BANKLA.mjs} +2 -2
- package/dist/esm/{chunk-CQS6ZCJ7.mjs → chunk-5AQEETAC.mjs} +1 -1
- package/dist/esm/chunk-5AQEETAC.mjs.map +1 -0
- package/dist/esm/{chunk-6BR5UJDT.mjs → chunk-63AIRYJX.mjs} +2 -2
- package/dist/esm/{chunk-WHA7RISE.mjs → chunk-647IOEXV.mjs} +2 -2
- package/dist/esm/{chunk-OWXKKVWD.mjs → chunk-6CBPMYW5.mjs} +2 -2
- package/dist/esm/chunk-6CBPMYW5.mjs.map +1 -0
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
- package/dist/esm/chunk-7CAEMK4R.mjs +2 -0
- package/dist/esm/chunk-7CAEMK4R.mjs.map +1 -0
- package/dist/esm/{chunk-GQR35QW3.mjs → chunk-7PYFGGHM.mjs} +2 -2
- package/dist/esm/chunk-7PYFGGHM.mjs.map +1 -0
- package/dist/esm/{chunk-LPB7SZHL.mjs → chunk-A7MSW6OL.mjs} +2 -2
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/{chunk-RIUFW2OG.mjs → chunk-AP7UZTPZ.mjs} +2 -2
- package/dist/esm/{chunk-45ZZWQ7X.mjs → chunk-BMKDEIRL.mjs} +2 -2
- package/dist/esm/chunk-BMKDEIRL.mjs.map +1 -0
- package/dist/esm/{chunk-EV75CYGN.mjs → chunk-BSEQPVD6.mjs} +2 -2
- package/dist/esm/chunk-BWFJHFBQ.mjs +2 -0
- package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-DMKUAQB7.mjs} +2 -2
- package/dist/esm/chunk-DSTKXJMA.mjs +2 -0
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-G56GPLTB.mjs → chunk-FS3NSGBF.mjs} +2 -2
- package/dist/esm/{chunk-UEKKYJGA.mjs → chunk-G2QII3AT.mjs} +2 -2
- package/dist/esm/{chunk-ZBT4HP6E.mjs → chunk-GMVVQD72.mjs} +2 -2
- package/dist/esm/chunk-GMVVQD72.mjs.map +1 -0
- package/dist/esm/{chunk-DUP7XY5P.mjs → chunk-GXVUN32G.mjs} +2 -2
- package/dist/esm/{chunk-EKR6HLSN.mjs → chunk-H4UVHJ3M.mjs} +2 -2
- package/dist/esm/{chunk-GKGTODGE.mjs → chunk-HB6T27S2.mjs} +2 -2
- package/dist/esm/{chunk-KS7UY4W5.mjs → chunk-HXN2WRUX.mjs} +2 -2
- package/dist/esm/{chunk-IHPWATYH.mjs → chunk-I7YI22IW.mjs} +2 -2
- package/dist/esm/chunk-I7YI22IW.mjs.map +1 -0
- package/dist/esm/{chunk-TVHLZDCO.mjs → chunk-IA6XM7QE.mjs} +2 -2
- package/dist/esm/chunk-IA6XM7QE.mjs.map +1 -0
- package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-IOSQVDZI.mjs} +2 -2
- package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-IOSQVDZI.mjs.map} +1 -1
- package/dist/esm/{chunk-5RUPEEIG.mjs → chunk-IS3OLRMB.mjs} +2 -2
- package/dist/esm/chunk-IS3OLRMB.mjs.map +1 -0
- package/dist/esm/{chunk-URTTOOEM.mjs → chunk-KL6VJ3UK.mjs} +2 -2
- package/dist/esm/{chunk-MXO53VAI.mjs → chunk-KOAUBVO6.mjs} +2 -2
- package/dist/esm/{chunk-KXR3IUJ7.mjs → chunk-KUOIRTNL.mjs} +2 -2
- package/dist/esm/chunk-KVIVMWN5.mjs +2 -0
- package/dist/esm/chunk-L4Q2XTHT.mjs +2 -0
- package/dist/esm/chunk-MIEV7J74.mjs +2 -0
- package/dist/esm/chunk-MIEV7J74.mjs.map +1 -0
- package/dist/esm/{chunk-5EN52MUT.mjs → chunk-NPFNYP75.mjs} +2 -2
- package/dist/esm/chunk-OKCU4GHN.mjs +2 -0
- package/dist/esm/chunk-OKCU4GHN.mjs.map +1 -0
- package/dist/esm/{chunk-V6FZ7WZH.mjs → chunk-ONDQ4MK7.mjs} +2 -2
- package/dist/esm/{chunk-NJRNZEHX.mjs → chunk-OWW6SIDP.mjs} +1 -1
- package/dist/esm/chunk-OWW6SIDP.mjs.map +1 -0
- package/dist/esm/chunk-QIAHBEEW.mjs +2 -0
- package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-QIAHBEEW.mjs.map} +1 -1
- package/dist/esm/{chunk-SK5TPUAN.mjs → chunk-QK4P26SH.mjs} +2 -2
- package/dist/esm/{chunk-YZGEWPDE.mjs → chunk-QTSECE7R.mjs} +2 -2
- package/dist/esm/chunk-QTSECE7R.mjs.map +1 -0
- package/dist/esm/{chunk-Y2MYVQVT.mjs → chunk-QVKMFPAV.mjs} +2 -2
- package/dist/esm/{chunk-IYSHHN5A.mjs → chunk-QW3VNZJ7.mjs} +2 -2
- package/dist/esm/chunk-R5QUBEH6.mjs +2 -0
- package/dist/esm/{chunk-JOLLCFQL.mjs → chunk-RAYJRFIG.mjs} +2 -2
- package/dist/esm/{chunk-JOLLCFQL.mjs.map → chunk-RAYJRFIG.mjs.map} +1 -1
- package/dist/esm/{chunk-35EWRSDK.mjs → chunk-RHBCVCOS.mjs} +2 -2
- package/dist/esm/{chunk-KLAYDUFD.mjs → chunk-SDUIZ3FY.mjs} +2 -2
- package/dist/esm/chunk-SDUIZ3FY.mjs.map +1 -0
- package/dist/esm/{chunk-XDXI3TRT.mjs → chunk-TBFLWWV4.mjs} +2 -2
- package/dist/esm/chunk-TBMAJ6AW.mjs +2 -0
- package/dist/esm/chunk-TGLSJGFO.mjs +2 -0
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/chunk-TLKV4NHK.mjs +2 -0
- package/dist/esm/chunk-TLKV4NHK.mjs.map +1 -0
- package/dist/esm/{chunk-2EZJOBD2.mjs → chunk-TR2YS7DT.mjs} +2 -2
- package/dist/esm/chunk-TR2YS7DT.mjs.map +1 -0
- package/dist/esm/{chunk-MJPUASSD.mjs → chunk-U43IJHQN.mjs} +2 -2
- package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-UML2VQZT.mjs} +2 -2
- package/dist/esm/{chunk-Q73VKL3A.mjs → chunk-V4YBGBCN.mjs} +2 -2
- package/dist/esm/{chunk-WMJXRWVE.mjs → chunk-V6SPPOWX.mjs} +2 -2
- package/dist/esm/{chunk-6ILDDGAX.mjs → chunk-VBTJVPAM.mjs} +2 -2
- package/dist/esm/{chunk-AEVRPB4E.mjs → chunk-VM3EJYJU.mjs} +2 -2
- package/dist/esm/chunk-VM3EJYJU.mjs.map +1 -0
- package/dist/esm/chunk-VX6LTXGB.mjs +2 -0
- package/dist/esm/chunk-VX6LTXGB.mjs.map +1 -0
- package/dist/esm/chunk-WEZXFWPR.mjs +2 -0
- package/dist/esm/{chunk-CXR7MOBW.mjs.map → chunk-WEZXFWPR.mjs.map} +1 -1
- package/dist/esm/chunk-WFZDFFBM.mjs +2 -0
- package/dist/esm/{chunk-U43KR4TW.mjs → chunk-XYLYHSEI.mjs} +2 -2
- package/dist/esm/chunk-Y2VA7F5D.mjs +2 -0
- package/dist/esm/chunk-Y2VA7F5D.mjs.map +1 -0
- package/dist/esm/{chunk-TTUXAKCV.mjs → chunk-Y5M5DD64.mjs} +2 -2
- package/dist/esm/{chunk-CAGDOGXS.mjs → chunk-YWQLLV2R.mjs} +2 -2
- package/dist/esm/chunk-ZEXZ4CX5.mjs +2 -0
- package/dist/esm/{chunk-6APZ5TPE.mjs → chunk-ZKNM27TR.mjs} +2 -2
- package/dist/esm/{chunk-QJAI7DNA.mjs → chunk-ZPNCA4C7.mjs} +2 -2
- package/dist/esm/chunk-ZYYK3UXP.mjs +2 -0
- package/dist/esm/client/core.mjs +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/client/types.mjs +1 -1
- package/dist/esm/core/account/Account.d.mts +2 -2
- package/dist/esm/core/account/Account.mjs +1 -1
- package/dist/esm/core/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/core/account/Ed25519Account.mjs +1 -1
- package/dist/esm/core/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/core/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +2 -2
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +9 -2
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +8 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.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 +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +3 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +3 -3
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +6 -6
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +2 -2
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +5 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -2
- 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 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -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 +1 -1
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +7 -6
- package/src/api/account.ts +48 -7
- package/src/api/ans.ts +8 -16
- package/src/api/aptos.ts +4 -0
- package/src/api/aptosConfig.ts +4 -0
- package/src/api/coin.ts +7 -0
- package/src/api/digitalAsset.ts +140 -1
- package/src/api/event.ts +13 -8
- package/src/api/faucet.ts +3 -0
- package/src/api/fungibleAsset.ts +27 -4
- package/src/api/general.ts +48 -25
- package/src/api/staking.ts +9 -0
- package/src/api/transaction.ts +57 -14
- package/src/client/core.ts +2 -1
- package/src/core/crypto/ed25519.ts +44 -10
- package/src/core/crypto/secp256k1.ts +9 -3
- package/src/internal/account.ts +6 -9
- package/src/internal/digitalAsset.ts +1 -1
- package/src/internal/fungibleAsset.ts +3 -3
- package/src/internal/transaction.ts +48 -10
- package/src/types/index.ts +1 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2EZJOBD2.mjs.map +0 -1
- package/dist/esm/chunk-3AYBWD76.mjs.map +0 -1
- package/dist/esm/chunk-45ZZWQ7X.mjs.map +0 -1
- package/dist/esm/chunk-4ILXLBGX.mjs +0 -2
- package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
- package/dist/esm/chunk-5GKROFZ4.mjs +0 -2
- package/dist/esm/chunk-5GKROFZ4.mjs.map +0 -1
- package/dist/esm/chunk-5RUPEEIG.mjs.map +0 -1
- package/dist/esm/chunk-AEVRPB4E.mjs.map +0 -1
- package/dist/esm/chunk-ARGODLTZ.mjs +0 -2
- package/dist/esm/chunk-ARGODLTZ.mjs.map +0 -1
- package/dist/esm/chunk-ASXXZH2D.mjs +0 -2
- package/dist/esm/chunk-ASXXZH2D.mjs.map +0 -1
- package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
- package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
- package/dist/esm/chunk-CQS6ZCJ7.mjs.map +0 -1
- package/dist/esm/chunk-CXR7MOBW.mjs +0 -2
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-FKTXWOKR.mjs +0 -2
- package/dist/esm/chunk-FKTXWOKR.mjs.map +0 -1
- package/dist/esm/chunk-GQR35QW3.mjs.map +0 -1
- package/dist/esm/chunk-IHPWATYH.mjs.map +0 -1
- package/dist/esm/chunk-IZF6DFAL.mjs +0 -2
- package/dist/esm/chunk-KLAYDUFD.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
- package/dist/esm/chunk-NJRNZEHX.mjs.map +0 -1
- package/dist/esm/chunk-OWXKKVWD.mjs.map +0 -1
- package/dist/esm/chunk-PF57EOJY.mjs +0 -2
- package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
- package/dist/esm/chunk-SWZOGZJ6.mjs +0 -2
- package/dist/esm/chunk-SWZOGZJ6.mjs.map +0 -1
- package/dist/esm/chunk-T6J2LHHS.mjs +0 -2
- package/dist/esm/chunk-T6J2LHHS.mjs.map +0 -1
- package/dist/esm/chunk-TVHLZDCO.mjs.map +0 -1
- package/dist/esm/chunk-UGPALAPN.mjs +0 -2
- package/dist/esm/chunk-W3V4IGGB.mjs +0 -2
- package/dist/esm/chunk-XX5J7KKC.mjs +0 -2
- package/dist/esm/chunk-YZGEWPDE.mjs.map +0 -1
- package/dist/esm/chunk-ZBT4HP6E.mjs.map +0 -1
- package/dist/esm/chunk-ZTIRBBNS.mjs +0 -2
- /package/dist/esm/{chunk-4ILXLBGX.mjs.map → chunk-3CLYWZYZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-C7YANDB2.mjs.map → chunk-3F6EYD5O.mjs.map} +0 -0
- /package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-52C73T26.mjs.map} +0 -0
- /package/dist/esm/{chunk-SOBCWGBM.mjs.map → chunk-54BANKLA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6BR5UJDT.mjs.map → chunk-63AIRYJX.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHA7RISE.mjs.map → chunk-647IOEXV.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
- /package/dist/esm/{chunk-LPB7SZHL.mjs.map → chunk-A7MSW6OL.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-RIUFW2OG.mjs.map → chunk-AP7UZTPZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-EV75CYGN.mjs.map → chunk-BSEQPVD6.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-BWFJHFBQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-DMKUAQB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-DSTKXJMA.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-FS3NSGBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-UEKKYJGA.mjs.map → chunk-G2QII3AT.mjs.map} +0 -0
- /package/dist/esm/{chunk-DUP7XY5P.mjs.map → chunk-GXVUN32G.mjs.map} +0 -0
- /package/dist/esm/{chunk-EKR6HLSN.mjs.map → chunk-H4UVHJ3M.mjs.map} +0 -0
- /package/dist/esm/{chunk-GKGTODGE.mjs.map → chunk-HB6T27S2.mjs.map} +0 -0
- /package/dist/esm/{chunk-KS7UY4W5.mjs.map → chunk-HXN2WRUX.mjs.map} +0 -0
- /package/dist/esm/{chunk-URTTOOEM.mjs.map → chunk-KL6VJ3UK.mjs.map} +0 -0
- /package/dist/esm/{chunk-MXO53VAI.mjs.map → chunk-KOAUBVO6.mjs.map} +0 -0
- /package/dist/esm/{chunk-KXR3IUJ7.mjs.map → chunk-KUOIRTNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IZF6DFAL.mjs.map → chunk-KVIVMWN5.mjs.map} +0 -0
- /package/dist/esm/{chunk-W3V4IGGB.mjs.map → chunk-L4Q2XTHT.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-NPFNYP75.mjs.map} +0 -0
- /package/dist/esm/{chunk-V6FZ7WZH.mjs.map → chunk-ONDQ4MK7.mjs.map} +0 -0
- /package/dist/esm/{chunk-SK5TPUAN.mjs.map → chunk-QK4P26SH.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y2MYVQVT.mjs.map → chunk-QVKMFPAV.mjs.map} +0 -0
- /package/dist/esm/{chunk-IYSHHN5A.mjs.map → chunk-QW3VNZJ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-R5QUBEH6.mjs.map} +0 -0
- /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-RHBCVCOS.mjs.map} +0 -0
- /package/dist/esm/{chunk-XDXI3TRT.mjs.map → chunk-TBFLWWV4.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-TBMAJ6AW.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZTIRBBNS.mjs.map → chunk-TGLSJGFO.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-MJPUASSD.mjs.map → chunk-U43IJHQN.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-UML2VQZT.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q73VKL3A.mjs.map → chunk-V4YBGBCN.mjs.map} +0 -0
- /package/dist/esm/{chunk-WMJXRWVE.mjs.map → chunk-V6SPPOWX.mjs.map} +0 -0
- /package/dist/esm/{chunk-6ILDDGAX.mjs.map → chunk-VBTJVPAM.mjs.map} +0 -0
- /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-WFZDFFBM.mjs.map} +0 -0
- /package/dist/esm/{chunk-U43KR4TW.mjs.map → chunk-XYLYHSEI.mjs.map} +0 -0
- /package/dist/esm/{chunk-TTUXAKCV.mjs.map → chunk-Y5M5DD64.mjs.map} +0 -0
- /package/dist/esm/{chunk-CAGDOGXS.mjs.map → chunk-YWQLLV2R.mjs.map} +0 -0
- /package/dist/esm/{chunk-XX5J7KKC.mjs.map → chunk-ZEXZ4CX5.mjs.map} +0 -0
- /package/dist/esm/{chunk-6APZ5TPE.mjs.map → chunk-ZKNM27TR.mjs.map} +0 -0
- /package/dist/esm/{chunk-QJAI7DNA.mjs.map → chunk-ZPNCA4C7.mjs.map} +0 -0
- /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-ZYYK3UXP.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
package/src/api/transaction.ts
CHANGED
|
@@ -63,6 +63,9 @@ export class Transaction {
|
|
|
63
63
|
* Queries on-chain transactions. This function will not return pending
|
|
64
64
|
* transactions. For that, use `getTransactionsByHash`.
|
|
65
65
|
*
|
|
66
|
+
* @example
|
|
67
|
+
* const transactions = await aptos.getTransactions()
|
|
68
|
+
*
|
|
66
69
|
* @param args.options.offset The number transaction to start with
|
|
67
70
|
* @param args.options.limit Number of results to return
|
|
68
71
|
*
|
|
@@ -78,6 +81,9 @@ export class Transaction {
|
|
|
78
81
|
/**
|
|
79
82
|
* Queries on-chain transaction by version. This function will not return pending transactions.
|
|
80
83
|
*
|
|
84
|
+
* @example
|
|
85
|
+
* const transaction = await aptos.getTransactions({ledgerVersion:1})
|
|
86
|
+
*
|
|
81
87
|
* @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.
|
|
82
88
|
* @returns On-chain transaction. Only on-chain transactions have versions, so this
|
|
83
89
|
* function cannot be used to query pending transactions.
|
|
@@ -91,6 +97,10 @@ export class Transaction {
|
|
|
91
97
|
|
|
92
98
|
/**
|
|
93
99
|
* Queries on-chain transaction by transaction hash. This function will return pending transactions.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const transaction = await aptos.getTransactionByHash({transactionHash:"0x123"})
|
|
103
|
+
*
|
|
94
104
|
* @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.
|
|
95
105
|
* @returns Transaction from mempool (pending) or on-chain (committed) transaction
|
|
96
106
|
*/
|
|
@@ -110,6 +120,9 @@ export class Transaction {
|
|
|
110
120
|
* 2. Apply hash algorithm SHA3-256 to the hash message bytes.
|
|
111
121
|
* 3. Hex-encode the hash bytes with 0x prefix.
|
|
112
122
|
*
|
|
123
|
+
* @example
|
|
124
|
+
* const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:"0x123"})
|
|
125
|
+
*
|
|
113
126
|
* @param args.transactionHash A hash of transaction
|
|
114
127
|
* @returns `true` if transaction is in pending state and `false` otherwise
|
|
115
128
|
*/
|
|
@@ -135,6 +148,8 @@ export class Transaction {
|
|
|
135
148
|
* 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.
|
|
136
149
|
* - The function will throw a WaitForTransactionError
|
|
137
150
|
*
|
|
151
|
+
* @example
|
|
152
|
+
* const transaction = await aptos.waitForTransaction({transactionHash:"0x123"})
|
|
138
153
|
*
|
|
139
154
|
* @param args.transactionHash The hash of a transaction previously submitted to the blockchain.
|
|
140
155
|
* @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.
|
|
@@ -158,14 +173,9 @@ export class Transaction {
|
|
|
158
173
|
* For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}
|
|
159
174
|
*
|
|
160
175
|
* @returns Object holding the outputs of the estimate gas API
|
|
176
|
+
*
|
|
161
177
|
* @example
|
|
162
|
-
*
|
|
163
|
-
* {
|
|
164
|
-
* gas_estimate: number;
|
|
165
|
-
* deprioritized_gas_estimate?: number;
|
|
166
|
-
* prioritized_gas_estimate?: number;
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
178
|
+
* const gasPrice = await aptos.waitForTransaction()
|
|
169
179
|
*/
|
|
170
180
|
async getGasPriceEstimation(): Promise<GasEstimation> {
|
|
171
181
|
return getGasPriceEstimation({
|
|
@@ -178,6 +188,11 @@ export class Transaction {
|
|
|
178
188
|
*
|
|
179
189
|
* This allows a user to sign a transaction using their own preferred signing method, and
|
|
180
190
|
* then submit it to the network.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
194
|
+
* const message = await aptos.getSigningMessage({transaction})
|
|
195
|
+
*
|
|
181
196
|
* @param args.transaction A raw transaction for signing elsewhere
|
|
182
197
|
*/
|
|
183
198
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -192,6 +207,13 @@ export class Transaction {
|
|
|
192
207
|
* `aptos move compile --save-metadata ...`,
|
|
193
208
|
* For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}
|
|
194
209
|
*
|
|
210
|
+
* @example
|
|
211
|
+
* const transaction = await aptos.publishPackageTransaction({
|
|
212
|
+
* account: alice,
|
|
213
|
+
* metadataBytes,
|
|
214
|
+
* moduleBytecode: [byteCode],
|
|
215
|
+
* })
|
|
216
|
+
*
|
|
195
217
|
* @param args.account The publisher account
|
|
196
218
|
* @param args.metadataBytes The package metadata bytes
|
|
197
219
|
* @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order
|
|
@@ -212,6 +234,13 @@ export class Transaction {
|
|
|
212
234
|
* the account.
|
|
213
235
|
* Note: Only legacy Ed25519 scheme is supported for now.
|
|
214
236
|
* More info: {@link https://aptos.dev/guides/account-management/key-rotation/}
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* const response = await aptos.rotateAuthKey({
|
|
240
|
+
* fromAccount: alice,
|
|
241
|
+
* toNewPrivateKey: new ED25519PublicKey("0x123"),
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
215
244
|
* @param args.fromAccount The account to rotate the auth key for
|
|
216
245
|
* @param args.toNewPrivateKey The new private key to rotate to
|
|
217
246
|
*
|
|
@@ -224,6 +253,13 @@ export class Transaction {
|
|
|
224
253
|
/**
|
|
225
254
|
* Sign a transaction that can later be submitted to chain
|
|
226
255
|
*
|
|
256
|
+
* @example
|
|
257
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
258
|
+
* const transaction = await aptos.transaction.sign({
|
|
259
|
+
* signer: alice,
|
|
260
|
+
* transaction
|
|
261
|
+
* })
|
|
262
|
+
*
|
|
227
263
|
* @param args.signer The signer account
|
|
228
264
|
* @param args.transaction A raw transaction to sign on
|
|
229
265
|
*
|
|
@@ -239,6 +275,13 @@ export class Transaction {
|
|
|
239
275
|
/**
|
|
240
276
|
* Sign a transaction as a fee payer that can later be submitted to chain
|
|
241
277
|
*
|
|
278
|
+
* @example
|
|
279
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
280
|
+
* const transaction = await aptos.transaction.signAsFeePayer({
|
|
281
|
+
* signer: alice,
|
|
282
|
+
* transaction
|
|
283
|
+
* })
|
|
284
|
+
*
|
|
242
285
|
* @param args.signer The fee payer signer account
|
|
243
286
|
* @param args.transaction A raw transaction to sign on
|
|
244
287
|
*
|
|
@@ -301,13 +344,13 @@ export class Transaction {
|
|
|
301
344
|
*
|
|
302
345
|
* @param args.signer The signer account to sign the transaction
|
|
303
346
|
* @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
350
|
+
* const transaction = await aptos.signAndSubmitTransaction({
|
|
351
|
+
* signer: alice,
|
|
352
|
+
* transaction
|
|
353
|
+
* })
|
|
311
354
|
*
|
|
312
355
|
* @return PendingTransactionResponse
|
|
313
356
|
*/
|
package/src/client/core.ts
CHANGED
|
@@ -26,11 +26,12 @@ const errors: Record<number, string> = {
|
|
|
26
26
|
* returns the response.
|
|
27
27
|
*/
|
|
28
28
|
export async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {
|
|
29
|
-
const { url, method, body, contentType, params, overrides } = options;
|
|
29
|
+
const { url, method, body, contentType, params, overrides, originMethod } = options;
|
|
30
30
|
const headers: Record<string, string | AnyNumber | boolean | undefined> = {
|
|
31
31
|
...overrides?.HEADERS,
|
|
32
32
|
"x-aptos-client": `aptos-typescript-sdk/${VERSION}`,
|
|
33
33
|
"content-type": contentType ?? MimeType.JSON,
|
|
34
|
+
"x-aptos-typescript-sdk-origin-method": originMethod,
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
if (overrides?.AUTH_TOKEN) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { ed25519 } from "@noble/curves/ed25519";
|
|
5
5
|
import { Deserializer } from "../../bcs/deserializer";
|
|
6
6
|
import { Serializable, Serializer } from "../../bcs/serializer";
|
|
7
7
|
import { AuthenticationKey } from "../authenticationKey";
|
|
@@ -13,6 +13,14 @@ import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
|
|
|
13
13
|
import { Signature } from "./signature";
|
|
14
14
|
import { convertSigningMessage } from "./utils";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected
|
|
18
|
+
*/
|
|
19
|
+
const L: number[] = [
|
|
20
|
+
0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,
|
|
21
|
+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
|
|
22
|
+
];
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* Represents the public key of an Ed25519 key pair.
|
|
18
26
|
*
|
|
@@ -65,7 +73,12 @@ export class Ed25519PublicKey extends AccountPublicKey {
|
|
|
65
73
|
const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
|
|
66
74
|
const signatureBytes = signature.toUint8Array();
|
|
67
75
|
const publicKeyBytes = this.key.toUint8Array();
|
|
68
|
-
|
|
76
|
+
// Also verify malleability
|
|
77
|
+
if (!signature.isCanonicalSignature()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);
|
|
69
82
|
}
|
|
70
83
|
|
|
71
84
|
authKey(): AuthenticationKey {
|
|
@@ -126,7 +139,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
126
139
|
* The Ed25519 signing key
|
|
127
140
|
* @private
|
|
128
141
|
*/
|
|
129
|
-
private readonly
|
|
142
|
+
private readonly signingKey: Hex;
|
|
130
143
|
|
|
131
144
|
// region Constructors
|
|
132
145
|
|
|
@@ -144,7 +157,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
144
157
|
}
|
|
145
158
|
|
|
146
159
|
// Create keyPair from Private key in Uint8Array format
|
|
147
|
-
this.
|
|
160
|
+
this.signingKey = privateKeyHex;
|
|
148
161
|
}
|
|
149
162
|
|
|
150
163
|
/**
|
|
@@ -153,8 +166,8 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
153
166
|
* @returns Ed25519PrivateKey
|
|
154
167
|
*/
|
|
155
168
|
static generate(): Ed25519PrivateKey {
|
|
156
|
-
const keyPair =
|
|
157
|
-
return new Ed25519PrivateKey(keyPair
|
|
169
|
+
const keyPair = ed25519.utils.randomPrivateKey();
|
|
170
|
+
return new Ed25519PrivateKey(keyPair);
|
|
158
171
|
}
|
|
159
172
|
|
|
160
173
|
/**
|
|
@@ -207,7 +220,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
207
220
|
* @returns Ed25519PublicKey
|
|
208
221
|
*/
|
|
209
222
|
publicKey(): Ed25519PublicKey {
|
|
210
|
-
const bytes = this.
|
|
223
|
+
const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());
|
|
211
224
|
return new Ed25519PublicKey(bytes);
|
|
212
225
|
}
|
|
213
226
|
|
|
@@ -220,7 +233,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
220
233
|
sign(message: HexInput): Ed25519Signature {
|
|
221
234
|
const messageToSign = convertSigningMessage(message);
|
|
222
235
|
const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();
|
|
223
|
-
const signatureBytes =
|
|
236
|
+
const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());
|
|
224
237
|
return new Ed25519Signature(signatureBytes);
|
|
225
238
|
}
|
|
226
239
|
|
|
@@ -230,7 +243,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
230
243
|
* @returns Uint8Array representation of the private key
|
|
231
244
|
*/
|
|
232
245
|
toUint8Array(): Uint8Array {
|
|
233
|
-
return this.
|
|
246
|
+
return this.signingKey.toUint8Array();
|
|
234
247
|
}
|
|
235
248
|
|
|
236
249
|
/**
|
|
@@ -239,7 +252,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
239
252
|
* @returns string representation of the private key
|
|
240
253
|
*/
|
|
241
254
|
toString(): string {
|
|
242
|
-
return
|
|
255
|
+
return this.signingKey.toString();
|
|
243
256
|
}
|
|
244
257
|
|
|
245
258
|
// endregion
|
|
@@ -312,5 +325,26 @@ export class Ed25519Signature extends Signature {
|
|
|
312
325
|
return new Ed25519Signature(bytes);
|
|
313
326
|
}
|
|
314
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Checks if an ED25519 signature is non-canonical.
|
|
330
|
+
*
|
|
331
|
+
* Comes from Aptos Core
|
|
332
|
+
* https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85
|
|
333
|
+
*/
|
|
334
|
+
isCanonicalSignature(): boolean {
|
|
335
|
+
const s = this.toUint8Array().slice(32);
|
|
336
|
+
|
|
337
|
+
for (let i = s.length - 1; i >= 0; i -= 1) {
|
|
338
|
+
if (s[i] < L[i]) {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
if (s[i] > L[i]) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// As this stage S == L which implies a non-canonical S.
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
|
|
315
349
|
// endregion
|
|
316
350
|
}
|
|
@@ -41,7 +41,11 @@ export class Secp256k1PublicKey extends PublicKey {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// region PublicKey
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Verifies a Secp256k1 signature against the public key
|
|
46
|
+
*
|
|
47
|
+
* Note signatures are validated to be canonical as a malleability check
|
|
48
|
+
*/
|
|
45
49
|
verifySignature(args: VerifySignatureArgs): boolean {
|
|
46
50
|
const { message, signature } = args;
|
|
47
51
|
if (!(signature instanceof Secp256k1Signature)) {
|
|
@@ -51,7 +55,7 @@ export class Secp256k1PublicKey extends PublicKey {
|
|
|
51
55
|
const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
|
|
52
56
|
const messageSha3Bytes = sha3_256(messageBytes);
|
|
53
57
|
const signatureBytes = signature.toUint8Array();
|
|
54
|
-
return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array());
|
|
58
|
+
return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array(), { lowS: true });
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
toUint8Array(): Uint8Array {
|
|
@@ -166,6 +170,8 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
|
|
|
166
170
|
/**
|
|
167
171
|
* Sign the given message with the private key.
|
|
168
172
|
*
|
|
173
|
+
* Note: signatures are canonical, and non-malleable
|
|
174
|
+
*
|
|
169
175
|
* @param message a message as a string or Uint8Array
|
|
170
176
|
* @returns Signature
|
|
171
177
|
*/
|
|
@@ -173,7 +179,7 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
|
|
|
173
179
|
const messageToSign = convertSigningMessage(message);
|
|
174
180
|
const messageBytes = Hex.fromHexInput(messageToSign);
|
|
175
181
|
const messageHashBytes = sha3_256(messageBytes.toUint8Array());
|
|
176
|
-
const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array());
|
|
182
|
+
const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array(), { lowS: true });
|
|
177
183
|
return new Secp256k1Signature(signature.toCompactRawBytes());
|
|
178
184
|
}
|
|
179
185
|
|
package/src/internal/account.ts
CHANGED
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
MoveStructId,
|
|
28
28
|
OrderByArg,
|
|
29
29
|
PaginationArgs,
|
|
30
|
-
SigningScheme,
|
|
31
30
|
TokenStandardArg,
|
|
32
31
|
TransactionResponse,
|
|
33
32
|
WhereArg,
|
|
@@ -528,16 +527,15 @@ export async function deriveAccountFromPrivateKey(args: {
|
|
|
528
527
|
|
|
529
528
|
if (privateKey instanceof Secp256k1PrivateKey) {
|
|
530
529
|
// private key is secp256k1, therefore we know it for sure uses a single signer key
|
|
531
|
-
const authKey = AuthenticationKey.
|
|
530
|
+
const authKey = AuthenticationKey.fromPublicKey({ publicKey });
|
|
532
531
|
const address = authKey.derivedAddress();
|
|
533
|
-
return Account.
|
|
532
|
+
return Account.fromPrivateKey({ privateKey, address });
|
|
534
533
|
}
|
|
535
534
|
|
|
536
535
|
if (privateKey instanceof Ed25519PrivateKey) {
|
|
537
536
|
// lookup single sender ed25519
|
|
538
|
-
const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.
|
|
537
|
+
const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({
|
|
539
538
|
publicKey,
|
|
540
|
-
scheme: SigningScheme.SingleKey,
|
|
541
539
|
});
|
|
542
540
|
const isSingleSenderTransactionAuthenticator = await isAccountExist({
|
|
543
541
|
authKey: singleSenderTransactionAuthenticatorAuthKey,
|
|
@@ -545,17 +543,16 @@ export async function deriveAccountFromPrivateKey(args: {
|
|
|
545
543
|
});
|
|
546
544
|
if (isSingleSenderTransactionAuthenticator) {
|
|
547
545
|
const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();
|
|
548
|
-
return Account.
|
|
546
|
+
return Account.fromPrivateKey({ privateKey, address, legacy: false });
|
|
549
547
|
}
|
|
550
548
|
// lookup legacy ed25519
|
|
551
|
-
const legacyAuthKey = AuthenticationKey.
|
|
549
|
+
const legacyAuthKey = AuthenticationKey.fromPublicKey({
|
|
552
550
|
publicKey: publicKey.publicKey as Ed25519PublicKey,
|
|
553
|
-
scheme: SigningScheme.Ed25519,
|
|
554
551
|
});
|
|
555
552
|
const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });
|
|
556
553
|
if (isLegacyEd25519) {
|
|
557
554
|
const address = legacyAuthKey.derivedAddress();
|
|
558
|
-
return Account.
|
|
555
|
+
return Account.fromPrivateKey({ privateKey, address, legacy: true });
|
|
559
556
|
}
|
|
560
557
|
}
|
|
561
558
|
// if we are here, it means we couldn't find an address with an
|
|
@@ -447,7 +447,7 @@ export async function mintSoulBoundTransaction(args: {
|
|
|
447
447
|
description: string;
|
|
448
448
|
name: string;
|
|
449
449
|
uri: string;
|
|
450
|
-
recipient:
|
|
450
|
+
recipient: AccountAddressInput;
|
|
451
451
|
propertyKeys?: Array<string>;
|
|
452
452
|
propertyTypes?: Array<PropertyType>;
|
|
453
453
|
propertyValues?: Array<PropertyValue>;
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
FungibleAssetActivitiesBoolExp,
|
|
34
34
|
FungibleAssetMetadataBoolExp,
|
|
35
35
|
} from "../types/generated/types";
|
|
36
|
-
import { Account,
|
|
36
|
+
import { Account, AccountAddressInput } from "../core";
|
|
37
37
|
import {
|
|
38
38
|
EntryFunctionABI,
|
|
39
39
|
InputGenerateTransactionOptions,
|
|
@@ -124,8 +124,8 @@ const faTransferAbi: EntryFunctionABI = {
|
|
|
124
124
|
export async function transferFungibleAsset(args: {
|
|
125
125
|
aptosConfig: AptosConfig;
|
|
126
126
|
sender: Account;
|
|
127
|
-
fungibleAssetMetadataAddress:
|
|
128
|
-
recipient:
|
|
127
|
+
fungibleAssetMetadataAddress: AccountAddressInput;
|
|
128
|
+
recipient: AccountAddressInput;
|
|
129
129
|
amount: AnyNumber;
|
|
130
130
|
options?: InputGenerateTransactionOptions;
|
|
131
131
|
}): Promise<SimpleTransaction> {
|
|
@@ -97,6 +97,19 @@ export async function isTransactionPending(args: {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
export async function longWaitForTransaction(args: {
|
|
101
|
+
aptosConfig: AptosConfig;
|
|
102
|
+
transactionHash: HexInput;
|
|
103
|
+
}): Promise<TransactionResponse> {
|
|
104
|
+
const { aptosConfig, transactionHash } = args;
|
|
105
|
+
const { data } = await getAptosFullNode<{}, TransactionResponse>({
|
|
106
|
+
aptosConfig,
|
|
107
|
+
path: `transactions/wait_by_hash/${transactionHash}`,
|
|
108
|
+
originMethod: "longWaitForTransaction",
|
|
109
|
+
});
|
|
110
|
+
return data;
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
export async function waitForTransaction(args: {
|
|
101
114
|
aptosConfig: AptosConfig;
|
|
102
115
|
transactionHash: HexInput;
|
|
@@ -113,6 +126,40 @@ export async function waitForTransaction(args: {
|
|
|
113
126
|
let backoffIntervalMs = 200;
|
|
114
127
|
const backoffMultiplier = 1.5;
|
|
115
128
|
|
|
129
|
+
function handleAPIError(e: any) {
|
|
130
|
+
// In short, this means we will retry if it was an AptosApiError and the code was 404 or 5xx.
|
|
131
|
+
const isAptosApiError = e instanceof AptosApiError;
|
|
132
|
+
if (!isAptosApiError) {
|
|
133
|
+
throw e; // This would be unexpected
|
|
134
|
+
}
|
|
135
|
+
lastError = e;
|
|
136
|
+
const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;
|
|
137
|
+
if (isRequestError) {
|
|
138
|
+
throw e;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// check to see if the txn is already on the blockchain
|
|
143
|
+
try {
|
|
144
|
+
lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });
|
|
145
|
+
isPending = lastTxn.type === TransactionResponseType.Pending;
|
|
146
|
+
} catch (e) {
|
|
147
|
+
handleAPIError(e);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// If the transaction is pending, we do a long wait once to avoid polling
|
|
151
|
+
if (isPending) {
|
|
152
|
+
const startTime = Date.now();
|
|
153
|
+
try {
|
|
154
|
+
lastTxn = await longWaitForTransaction({ aptosConfig, transactionHash });
|
|
155
|
+
isPending = lastTxn.type === TransactionResponseType.Pending;
|
|
156
|
+
} catch (e) {
|
|
157
|
+
handleAPIError(e);
|
|
158
|
+
}
|
|
159
|
+
timeElapsed = (Date.now() - startTime) / 1000;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Now we do polling to see if the transaction is still pending
|
|
116
163
|
while (isPending) {
|
|
117
164
|
if (timeElapsed >= timeoutSecs) {
|
|
118
165
|
break;
|
|
@@ -127,16 +174,7 @@ export async function waitForTransaction(args: {
|
|
|
127
174
|
break;
|
|
128
175
|
}
|
|
129
176
|
} catch (e) {
|
|
130
|
-
|
|
131
|
-
const isAptosApiError = e instanceof AptosApiError;
|
|
132
|
-
if (!isAptosApiError) {
|
|
133
|
-
throw e; // This would be unexpected
|
|
134
|
-
}
|
|
135
|
-
lastError = e;
|
|
136
|
-
const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;
|
|
137
|
-
if (isRequestError) {
|
|
138
|
-
throw e;
|
|
139
|
-
}
|
|
177
|
+
handleAPIError(e);
|
|
140
178
|
}
|
|
141
179
|
// eslint-disable-next-line no-await-in-loop
|
|
142
180
|
await sleep(backoffIntervalMs);
|
package/src/types/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getBlockByHeight,\n getBlockByVersion,\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n getTableItem,\n queryIndexer,\n} from \"../internal/general\";\nimport { view } from \"../internal/view\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n TableItemRequest,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { InputViewFunctionData } from \"../transactions\";\n\n/**\n * A class to query all `General` Aptos related queries\n */\nexport class General {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger info\n *\n * @returns Aptos Ledger Info\n *\n * @example An example of the returned data\n * ```\n * {\n * \"chain_id\": 4,\n * \"epoch\": \"8\",\n * \"ledger_version\": \"714\",\n * \"oldest_ledger_version\": \"0\",\n * \"ledger_timestamp\": \"1694695496521775\",\n * \"node_role\": \"validator\",\n * \"oldest_block_height\": \"0\",\n * \"block_height\": \"359\",\n * \"git_hash\": \"c82193f36f4e185fed9f68c4ad21f6c6dd390c6e\"\n * }\n * ```\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Queries for the chain id\n *\n * @returns The chain id\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Queries for block by transaction version\n *\n * @param args.ledgerVersion Ledger version to lookup block information for\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block information with optional transactions\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Get block by block height\n *\n * @param args.blockHeight Block height to lookup. Starts at 0\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block with optional transactions\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a table item for a table identified by the handle and the key for the item.\n * Key and value types need to be passed in to help with key serialization and value deserialization.\n * @param args.handle A pointer to where that table is stored\n * @param args.data Object that describes table item\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example https://api.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E\n * {\n * data.key_type = \"address\" // Move type of table key\n * data.value_type = \"u128\" // Move type of table value\n * data.key = \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * }\n *\n * @returns Table item value rendered in JSON\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @example\n * `\n * const payload: ViewRequest = {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * };\n * `\n *\n * @returns an array of Move values\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries top user transactions\n *\n * @param args.limit The number of transactions to return\n * @returns GetChainTopUserTransactionsResponse\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * A generic function for retrieving data from Aptos Indexer.\n * For more detailed queries specification see\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql}\n *\n * @param args.query.query A GraphQL query\n * @param args.query.variables The variables for the query\n * @example\n * ```\n * {\n * query: `query MyQuery {\n ledger_infos {\n chain_id\n }\n }`;\n * }\n * ```\n *\n * @return The provided T type\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version\n *\n * This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.\n */\n async getIndexerLastSuccessVersion(): Promise<bigint> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n\n /**\n * Query the processor status for a specific processor type.\n *\n * @param processorType The processor type to query\n * @returns\n */\n async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {\n return getProcessorStatus({ aptosConfig: this.config, processorType });\n }\n}\n"],"mappings":"mIAgCO,IAAMA,EAAN,KAAc,CAGnB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAsBA,MAAM,eAAqC,CACzC,OAAOC,EAAc,CAAE,YAAa,KAAK,MAAO,CAAC,CACnD,CAOA,MAAM,YAA8B,CAElC,OADe,MAAM,KAAK,cAAc,GAC1B,QAChB,CAUA,MAAM,kBAAkBC,EAGL,CACjB,OAAOC,EAAkB,CACvB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CAUA,MAAM,iBAAiBA,EAA4F,CACjH,OAAOE,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC/D,CAkBA,MAAM,aAAgBA,EAA0F,CAC9G,OAAOG,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC9D,CAiBA,MAAM,KAAiCA,EAGxB,CACb,OAAOI,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACtD,CAQA,MAAM,4BAA4BA,EAAuE,CACvG,OAAOK,EAA4B,CACjC,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAsBA,MAAM,aAA2BA,EAA2C,CAC1E,OAAOM,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGN,CACL,CAAC,CACH,CAOA,MAAM,8BAAgD,CACpD,OAAOO,EAA6B,CAAE,YAAa,KAAK,MAAO,CAAC,CAClE,CAQA,MAAM,mBAAmBC,EAAsE,CAC7F,OAAOC,EAAmB,CAAE,YAAa,KAAK,OAAQ,cAAAD,CAAc,CAAC,CACvE,CACF","names":["General","config","getLedgerInfo","args","getBlockByVersion","getBlockByHeight","getTableItem","view","getChainTopUserTransactions","queryIndexer","getIndexerLastSuccessVersion","processorType","getProcessorStatus"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/event.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n getAccountEventsByCreationNumber,\n getAccountEventsByEventType,\n getModuleEventsByEventType,\n getEvents,\n} from \"../internal/event\";\nimport { AnyNumber, GetEventsResponse, MoveStructId, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { EventsBoolExp } from \"../types/generated/types\";\nimport { AccountAddressInput } from \"../core\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Event` Aptos related queries\n */\nexport class Event {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Get module events by event type\n *\n * @param args.eventType - The event type\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns Promise<GetEventsResponse>\n */\n async getModuleEventsByEventType(args: {\n eventType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getModuleEventsByEventType({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Get events by creation number and an account address\n *\n * @param args.accountAddress - The account address\n * @param args.creationNumber - The event creation number\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns Promise<GetEventsResponse>\n */\n async getAccountEventsByCreationNumber(args: {\n accountAddress: AccountAddressInput;\n creationNumber: AnyNumber;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getAccountEventsByCreationNumber({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Get events by event type and an account address\n *\n * @param args.accountAddress - The account address\n * @param args.eventType - The event type\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns Promise<GetEventsResponse>\n */\n async getAccountEventsByEventType(args: {\n accountAddress: AccountAddressInput;\n eventType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getAccountEventsByEventType({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Get all events\n *\n * An optional `where` can be passed in to filter out the response.\n *@param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @example\n * ```\n * { where:\n * {\n * transaction_version: { _eq: 123456 },\n * }\n * }\n * ```\n *\n * @returns GetEventsQuery response type\n */\n async getEvents(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getEvents({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uGAmBO,IAAMA,EAAN,KAAY,CACjB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAU3C,MAAM,2BAA2BC,EAIF,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACME,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzE,CAWA,MAAM,iCAAiCA,EAIR,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMG,EAAiC,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/E,CAWA,MAAM,4BAA4BA,EAKH,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMI,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC1E,CAkBA,MAAM,UAAUA,EAGe,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,gCACF,CAAC,EACMK,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACxD,CACF","names":["Event","config","args","waitForIndexerOnVersion","getModuleEventsByEventType","getAccountEventsByCreationNumber","getAccountEventsByEventType","getEvents"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, AccountAddress, AccountAddressInput } from \"../core\";\nimport {\n RegisterNameParameters,\n getExpiration,\n getOwnerAddress,\n registerName,\n getPrimaryName,\n setPrimaryName,\n getTargetAddress,\n setTargetAddress,\n renewDomain,\n getName,\n getAccountDomains,\n GetAccountDomainsArgs,\n GetAccountSubdomainsArgs,\n getAccountSubdomains,\n getAccountNames,\n GetAccountNamesArgs,\n getDomainSubdomains,\n GetDomainSubdomainsArgs,\n} from \"../internal/ans\";\nimport { GetANSNameResponse } from \"../types\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class to handle all `ANS` operations\n */\nexport class ANS {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Retrieve the owner address of a domain name or subdomain name from the contract.\n *\n * ```ts\n * // Will return the owner address of \"test.aptos.apt\" or undefined\n * const owner = await aptos.getOwnerAddress({name: \"test.aptos\"})\n * // owner = 0x123...\n * ```\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns AccountAddress if the name is owned, undefined otherwise\n */\n async getOwnerAddress(args: { name: string }): Promise<AccountAddress | undefined> {\n return getOwnerAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the expiration time of a domain name or subdomain name from the contract.\n *\n * ```ts\n * // Will return the expiration of \"test.aptos.apt\" or undefined\n * const exp = await aptos.getExpiration({name: \"test.aptos\"})\n * // new Date(exp) would give you the date in question: 2021-01-01T00:00:00.000Z\n * ```\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns number as a unix timestamp in milliseconds.\n */\n async getExpiration(args: { name: string }): Promise<number | undefined> {\n return getExpiration({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * ```ts\n * const targetAddr = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // targetAddr = 0x123...\n * ```\n *\n * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.\n *\n * @returns AccountAddress if the name has a target, undefined otherwise\n */\n async getTargetAddress(args: { name: string }): Promise<AccountAddress | undefined> {\n return getTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * ```ts\n * await aptos.setTargetAddress({sender: alice, name: \"test.aptos\", address: bob.accountAddress})\n * const address = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // address = bob.accountAddress\n * ```\n *\n * @param args.name - A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc.\n * @param args.address - A AccountAddressInput of the address to set the domain or subdomain to\n *\n * @returns SimpleTransaction\n */\n async setTargetAddress(args: {\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the primary name for an account. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * ```ts\n * const name = await aptos.getPrimaryName({address: alice.accountAddress})\n * // name = test.aptos\n * ```\n *\n * @param args.address - A AccountAddressInput (address) of the account\n *\n * @returns a string if the account has a primary name, undefined otherwise\n */\n async getPrimaryName(args: { address: AccountAddressInput }): Promise<string | undefined> {\n return getPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the primary name for the sender. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * ```ts\n * await aptos.setPrimaryName({sender: alice, name: \"test.aptos\"})\n * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})\n * // primaryName = test.aptos\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name: test, test.apt, test.aptos, test.aptos.apt, etc.\n *\n * @returns SimpleTransaction\n */\n async setPrimaryName(args: {\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Registers a new name\n *\n * ```ts\n * // An example of registering a subdomain name assuming def.apt is already registered\n * // and belongs to the sender alice.\n * const txn = aptos.registerName({\n * sender: alice,\n * name: \"test.aptos.apt\",\n * expiration: {\n * policy: \"subdomain:independent\",\n * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000,\n * },\n * });\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name to register. This can be inclusive or exclusive of the .apt suffix.\n * Examples include: \"test\", \"test.apt\", \"test.aptos.apt\", etc.\n * @param args.expiration - An object with the expiration policy of the name.\n * @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent'\n * - domain: Years is required and the name will expire after the given number of years.\n * - subdomain:follow-domain: The name will expire at the same time as the domain name.\n * - subdomain:independent: The name will expire at the given date.\n * @param args.expiration.expirationDate - An epoch number in milliseconds of\n * the date when the subdomain will expire. Only applicable when the policy is\n * set to 'subdomain:independent'.\n * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains.\n * @param args.targetAddress optional - The address the domain name will resolve to. If not provided,\n * the sender's address will be used.\n * @param args.toAddress optional - The address to send the domain name to. If not provided,\n * the transaction will be sent to the router.\n *\n * @returns SimpleTransaction\n */\n async registerName(args: Omit<RegisterNameParameters, \"aptosConfig\">): Promise<SimpleTransaction> {\n return registerName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Renews a domain name\n *\n * Note: If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.\n *\n * ```ts\n * await aptos.renewDomain({sender: alice, name: \"test\"})\n * // test.apt will be renewed for one year\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the domain the subdomain will be under. The signer must be the domain owner.\n * Subdomains cannot be renewed.\n * @param args.years - The number of years to renew the name. Currently only one year is permitted.\n *\n * @returns SimpleTransaction\n */\n async renewDomain(args: {\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return renewDomain({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches a single name from the indexer\n * @param args.name - A string of the name to retrieve, e.g. \"test.aptos.apt\"\n * or \"test.apt\" or \"test\". Can be inclusive or exclusive of the .apt suffix.\n * Can be a subdomain.\n *\n * @returns A promise of an ANSName or undefined\n */\n async getName(args: { name: string }): Promise<GetANSNameResponse[0] | undefined> {\n return getName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all names for an account (both top level domains and subdomains)\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountNames(args: GetAccountNamesArgs): Promise<GetANSNameResponse> {\n return getAccountNames({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all top level domain names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve domain names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountDomains(args: GetAccountDomainsArgs): Promise<GetANSNameResponse> {\n return getAccountDomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve subdomains names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<GetANSNameResponse> {\n return getAccountSubdomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for a given domain. Note, this will not return the domain itself.\n *\n * @param args\n * @param args.domain - A string of the domain name: eg. \"test.apt\" or \"test\" (without the suffix of .apt)\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<GetANSNameResponse> {\n return getDomainSubdomains({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"6HAgCO,IAAMA,EAAN,KAAU,CACf,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAe3C,MAAM,gBAAgBC,EAA6D,CACjF,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CAeA,MAAM,cAAcA,EAAqD,CACvE,OAAOE,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC5D,CAgBA,MAAM,iBAAiBA,EAA6D,CAClF,OAAOG,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/D,CAkBA,MAAM,iBAAiBA,EAKQ,CAC7B,OAAOI,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC/D,CAgBA,MAAM,eAAeA,EAAqE,CACxF,OAAOK,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC7D,CAkBA,MAAM,eAAeA,EAIU,CAC7B,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAqCA,MAAM,aAAaA,EAA+E,CAChG,OAAOO,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3D,CAmBA,MAAM,YAAYA,EAKa,CAC7B,OAAOQ,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGR,CAAK,CAAC,CAC1D,CAUA,MAAM,QAAQA,EAAoE,CAChF,OAAOS,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGT,CAAK,CAAC,CACtD,CAcA,MAAM,gBAAgBA,EAAwD,CAC5E,OAAOU,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGV,CAAK,CAAC,CAC9D,CAcA,MAAM,kBAAkBA,EAA0D,CAChF,OAAOW,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGX,CAAK,CAAC,CAChE,CAcA,MAAM,qBAAqBA,EAA6D,CACtF,OAAOY,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGZ,CAAK,CAAC,CACnE,CAcA,MAAM,oBAAoBA,EAA4D,CACpF,OAAOa,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGb,CAAK,CAAC,CAClE,CACF","names":["ANS","config","args","getOwnerAddress","getExpiration","getTargetAddress","setTargetAddress","getPrimaryName","setPrimaryName","registerName","renewDomain","getName","getAccountNames","getAccountDomains","getAccountSubdomains","getDomainSubdomains"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-W3V4IGGB.mjs";import{a as i}from"./chunk-IZF6DFAL.mjs";import{a as r}from"./chunk-36QXVFR5.mjs";var n=class o extends r{constructor(t,a){super(),this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=e.deserialize(t),s=i.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4ILXLBGX.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as p}from"./chunk-URTTOOEM.mjs";import{c}from"./chunk-MJPUASSD.mjs";import{f as g,i as A}from"./chunk-U3YYSIIT.mjs";import{f as o}from"./chunk-TTUXAKCV.mjs";import{o as a,r,s as u}from"./chunk-S4SEFF4K.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:r,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:a,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[],parameters:[c("0x1::object::Object"),new A,new g]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return p({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
|
|
2
|
-
//# sourceMappingURL=chunk-5GKROFZ4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { Account, AccountAddress } from \"../core\";\nimport {\n EntryFunctionABI,\n InputGenerateTransactionOptions,\n parseTypeTag,\n TypeTagAddress,\n TypeTagU64,\n} from \"../transactions\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nconst faTransferAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [parseTypeTag(\"0x1::object::Object\"), new TypeTagAddress(), new TypeTagU64()],\n};\n\nexport async function transferFungibleAsset(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddress;\n recipient: AccountAddress;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::primary_fungible_store::transfer\",\n typeArguments: [\"0x1::fungible_asset::Metadata\"],\n functionArguments: [fungibleAssetMetadataAddress, recipient, amount],\n abi: faTransferAbi,\n },\n options,\n });\n}\n"],"mappings":"wNA8CA,eAAsBA,EAAyBC,EAGD,CAC5C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA4C,CAC7D,YAAAJ,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAEA,eAAsBG,EAA2BN,EAGD,CAC9C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBL,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA8C,CAC/D,YAAAJ,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAEA,eAAsBK,EAAgCR,EAGD,CACnD,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOM,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAAmD,CACpE,YAAAJ,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd,CAEA,IAAMO,EAAkC,CACtC,eAAgB,CAAC,EACjB,WAAY,CAACC,EAAa,qBAAqB,EAAG,IAAIC,EAAkB,IAAIC,CAAY,CAC1F,EAEA,eAAsBC,EAAsBd,EAOb,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAc,EAAQ,6BAAAC,EAA8B,UAAAC,EAAW,OAAAC,EAAQ,QAAAhB,CAAQ,EAAIF,EAC1F,OAAOmB,EAAoB,CACzB,YAAAlB,EACA,OAAQc,EAAO,eACf,KAAM,CACJ,SAAU,wCACV,cAAe,CAAC,+BAA+B,EAC/C,kBAAmB,CAACC,EAA8BC,EAAWC,CAAM,EACnE,IAAKR,CACP,EACA,QAAAR,CACF,CAAC,CACH","names":["getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","GetFungibleAssetMetadata","queryIndexer","getFungibleAssetActivities","GetFungibleAssetActivities","getCurrentFungibleAssetBalances","GetCurrentFungibleAssetBalances","faTransferAbi","parseTypeTag","TypeTagAddress","TypeTagU64","transferFungibleAsset","sender","fungibleAssetMetadataAddress","recipient","amount","generateTransaction"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * This creates an account if it does not exist and mints the specified amount of\n * coins into that account\n *\n * @param args.accountAddress Address of the account to fund\n * @param args.amount Amount of tokens to fund the account with\n * @param args.options Configuration options for waitForTransaction\n * @returns Transaction hash of the transaction that funded the account\n */\n async fundAccount(args: {\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n }): Promise<UserTransactionResponse> {\n const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n if (args.options?.waitForIndexer !== false) {\n await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n }\n\n return fundTxn;\n }\n}\n"],"mappings":"kFAYO,IAAMA,EAAN,KAAa,CAClB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAW3C,MAAM,YAAYC,EAImB,CACnC,IAAMC,EAAU,MAAMC,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,EAEvE,OAAIA,EAAK,SAAS,iBAAmB,IACnC,MAAMG,EAAe,CAAE,YAAa,KAAK,OAAQ,qBAAsB,OAAOF,EAAQ,OAAO,CAAE,CAAC,EAG3FA,CACT,CACF","names":["Faucet","config","args","fundTxn","fundAccount","waitForIndexer"]}
|