@aptos-labs/ts-sdk 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +1131 -989
- package/dist/browser/index.global.js +30 -30
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +1131 -989
- package/dist/common/index.js +25 -25
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.d.mts +12 -6
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +11 -12
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +13 -14
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +13 -13
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +20 -10
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +9 -10
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +13 -14
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +5 -6
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +11 -11
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
- 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-GD5TZLBF.mjs → chunk-27XWZ5HH.mjs} +2 -2
- package/dist/esm/{chunk-VPQ46CAO.mjs → chunk-2CZ7RDU5.mjs} +2 -2
- package/dist/esm/{chunk-SXIFL5DQ.mjs → chunk-2LRDOYKF.mjs} +2 -2
- package/dist/esm/chunk-2YB3QA6V.mjs +2 -0
- package/dist/esm/chunk-2YB3QA6V.mjs.map +1 -0
- package/dist/esm/{chunk-F7CR75CJ.mjs → chunk-3BWYI3KO.mjs} +2 -2
- package/dist/esm/chunk-3E4BKDQU.mjs +2 -0
- package/dist/esm/chunk-3E4BKDQU.mjs.map +1 -0
- package/dist/esm/chunk-3FGD73JA.mjs +2 -0
- package/dist/esm/chunk-3FGD73JA.mjs.map +1 -0
- package/dist/esm/{chunk-GD4ULEBC.mjs → chunk-4H3C3V6D.mjs} +2 -2
- package/dist/esm/{chunk-W4UDMBMU.mjs → chunk-4M3DGBX6.mjs} +2 -2
- package/dist/esm/chunk-53HSYUXO.mjs +2 -0
- package/dist/esm/chunk-53HSYUXO.mjs.map +1 -0
- package/dist/esm/chunk-5VWG45IO.mjs +2 -0
- package/dist/esm/chunk-5VWG45IO.mjs.map +1 -0
- package/dist/esm/chunk-5ZWEKLOT.mjs +2 -0
- package/dist/esm/chunk-5ZWEKLOT.mjs.map +1 -0
- package/dist/esm/chunk-637CGNKQ.mjs +2 -0
- package/dist/esm/chunk-637CGNKQ.mjs.map +1 -0
- package/dist/esm/chunk-6CSXIJR4.mjs +2 -0
- package/dist/esm/chunk-6CSXIJR4.mjs.map +1 -0
- package/dist/esm/{chunk-4OI7MPFH.mjs → chunk-AKBRO5YS.mjs} +2 -2
- package/dist/esm/{chunk-F7MOQC7Z.mjs → chunk-BMDNUQIP.mjs} +2 -2
- package/dist/esm/{chunk-EUHPML5E.mjs → chunk-BR6FLUGH.mjs} +2 -2
- package/dist/esm/{chunk-6SRENFWH.mjs → chunk-CARQVN57.mjs} +2 -2
- package/dist/esm/{chunk-Q5HK3U64.mjs → chunk-DGZIRX6Z.mjs} +2 -2
- package/dist/esm/{chunk-2DNPRIS5.mjs → chunk-DWRBQ52O.mjs} +2 -2
- package/dist/esm/{chunk-XBVORX5O.mjs → chunk-DZNEBO5A.mjs} +2 -2
- package/dist/esm/{chunk-Q3HAJVCM.mjs → chunk-FI2B5BQ2.mjs} +2 -2
- package/dist/esm/chunk-FWDKABRW.mjs +2 -0
- package/dist/esm/chunk-FWDKABRW.mjs.map +1 -0
- package/dist/esm/chunk-G542XORT.mjs +2 -0
- package/dist/esm/chunk-G542XORT.mjs.map +1 -0
- package/dist/esm/{chunk-4M46AWXX.mjs → chunk-HE4FXVC4.mjs} +2 -2
- package/dist/esm/chunk-HEPV52CH.mjs +2 -0
- package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
- package/dist/esm/chunk-HIUJDWMR.mjs +2 -0
- package/dist/esm/{chunk-MEPX7Z2Z.mjs.map → chunk-HIUJDWMR.mjs.map} +1 -1
- package/dist/esm/chunk-HK6O5AUH.mjs +2 -0
- package/dist/esm/chunk-HK6O5AUH.mjs.map +1 -0
- package/dist/esm/chunk-HWL7DK5X.mjs +2 -0
- package/dist/esm/chunk-HWL7DK5X.mjs.map +1 -0
- package/dist/esm/{chunk-QKTV6AZ7.mjs → chunk-HZO2FSG5.mjs} +2 -2
- package/dist/esm/{chunk-VRSUCKJA.mjs → chunk-IKKFQZDP.mjs} +2 -2
- package/dist/esm/{chunk-SPOHAEHR.mjs → chunk-J2P6ERQF.mjs} +2 -2
- package/dist/esm/chunk-JK2QAXF2.mjs +2 -0
- package/dist/esm/{chunk-XZYPAQCU.mjs.map → chunk-JK2QAXF2.mjs.map} +1 -1
- package/dist/esm/{chunk-S64WKSMI.mjs → chunk-JOYBEFKL.mjs} +2 -2
- package/dist/esm/{chunk-KJGQ4ILY.mjs → chunk-JW65YQSF.mjs} +2 -2
- package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
- package/dist/esm/chunk-L4CAATRY.mjs +2 -0
- package/dist/esm/chunk-L4CAATRY.mjs.map +1 -0
- package/dist/esm/{chunk-PJNPLRPR.mjs → chunk-L5WL2GGI.mjs} +2 -2
- package/dist/esm/chunk-L6NGU7XZ.mjs +2 -0
- package/dist/esm/chunk-L6NGU7XZ.mjs.map +1 -0
- package/dist/esm/{chunk-QRQAR6XO.mjs → chunk-LF67MEQF.mjs} +2 -2
- package/dist/esm/{chunk-AFPJ2XXN.mjs → chunk-M4DLGIKP.mjs} +2 -2
- package/dist/esm/{chunk-7D5LHQNS.mjs → chunk-MX5RTG3J.mjs} +2 -2
- package/dist/esm/{chunk-B2ZKW23W.mjs → chunk-NL6SHGNC.mjs} +2 -2
- package/dist/esm/chunk-ODJTKMBB.mjs +2 -0
- package/dist/esm/{chunk-SRZTA6QH.mjs.map → chunk-ODJTKMBB.mjs.map} +1 -1
- package/dist/esm/chunk-ODSW4WOX.mjs +2 -0
- package/dist/esm/chunk-ODSW4WOX.mjs.map +1 -0
- package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
- package/dist/esm/{chunk-ENKMOALS.mjs → chunk-QIKGTKEF.mjs} +2 -2
- package/dist/esm/chunk-QIKGTKEF.mjs.map +1 -0
- package/dist/esm/{chunk-M3WNE7MU.mjs → chunk-QT4YHSGZ.mjs} +2 -2
- package/dist/esm/{chunk-PMWH5IGI.mjs → chunk-QTKWCACE.mjs} +2 -2
- package/dist/esm/{chunk-QGIJNA37.mjs → chunk-RD4HGTGK.mjs} +2 -2
- package/dist/esm/{chunk-IHCIKE42.mjs → chunk-RG527TGB.mjs} +2 -2
- package/dist/esm/{chunk-ENDUXRTK.mjs → chunk-RSV64IPI.mjs} +2 -2
- package/dist/esm/{chunk-VKZCIGKY.mjs → chunk-SMND5Q5T.mjs} +2 -2
- package/dist/esm/chunk-SPF6BCNU.mjs +2 -0
- package/dist/esm/chunk-SPF6BCNU.mjs.map +1 -0
- package/dist/esm/{chunk-Y4AKS4CY.mjs → chunk-TCXBCK5T.mjs} +2 -2
- package/dist/esm/{chunk-PIXE7MN5.mjs → chunk-UCA6JL25.mjs} +2 -2
- package/dist/esm/{chunk-2WFMD6C6.mjs → chunk-UJB36GIR.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/{chunk-JJ6Y35DF.mjs → chunk-V5AIOBTO.mjs} +2 -2
- package/dist/esm/{chunk-O57QZZF2.mjs → chunk-VEBKGHUV.mjs} +2 -2
- package/dist/esm/chunk-VEBKGHUV.mjs.map +1 -0
- package/dist/esm/{chunk-PPTG6BDV.mjs → chunk-VRSSKMX4.mjs} +2 -2
- package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-X2OCPM7P.mjs} +2 -2
- package/dist/esm/{chunk-LATJGGVX.mjs → chunk-X34ZBPWT.mjs} +2 -2
- package/dist/esm/{chunk-V2FPYAK7.mjs → chunk-XA37GN3W.mjs} +2 -2
- package/dist/esm/{chunk-N4RBQZ2B.mjs → chunk-XGWFFSQ6.mjs} +2 -2
- package/dist/esm/{chunk-R56OJ4XC.mjs → chunk-YGW3VAPT.mjs} +2 -2
- package/dist/esm/{chunk-2H5Z5EHH.mjs → chunk-YNSKIECV.mjs} +2 -2
- package/dist/esm/{chunk-FRLPX47J.mjs → chunk-YXBNTR7V.mjs} +2 -2
- package/dist/esm/{chunk-JQVT2K7G.mjs → chunk-ZSPPXKRC.mjs} +2 -2
- 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/core/account/Account.d.mts +20 -0
- package/dist/esm/core/account/Account.mjs +2 -0
- package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
- package/dist/esm/core/account/Ed25519Account.mjs +2 -0
- package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
- package/dist/esm/core/account/index.d.mts +305 -0
- package/dist/esm/core/account/index.mjs +2 -0
- package/dist/esm/core/account/index.mjs.map +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +7 -68
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +49 -61
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +9 -6
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +70 -17
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +35 -0
- package/dist/esm/core/crypto/privateKey.mjs +2 -0
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +13 -0
- package/dist/esm/core/crypto/publicKey.mjs +2 -0
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +28 -0
- package/dist/esm/core/crypto/signature.mjs +2 -0
- package/dist/esm/core/crypto/signature.mjs.map +1 -0
- package/dist/esm/core/crypto/singleKey.d.mts +68 -0
- package/dist/esm/core/crypto/singleKey.mjs +2 -0
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
- package/dist/esm/core/index.d.mts +9 -8
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +8 -8
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +10 -4
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +11 -12
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +12 -12
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +17 -14
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +2 -2
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +4 -4
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +10 -11
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +3 -3
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +12 -13
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/publicKey-lq5djCIY.d.mts +113 -0
- package/dist/esm/transactions/authenticator/account.d.mts +6 -4
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +6 -6
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +6 -7
- 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 +4 -4
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +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.d.mts +2 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +11 -5
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +11 -12
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
- 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 +9 -9
- package/dist/esm/utils/const.d.mts +1 -2
- 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/aptosConfig.ts +2 -2
- package/src/api/digitalAsset.ts +20 -0
- package/src/core/account/Account.ts +245 -0
- package/src/core/account/Ed25519Account.ts +88 -0
- package/src/core/account/SingleKeyAccount.ts +120 -0
- package/src/core/account/index.ts +3 -0
- package/src/core/authenticationKey.ts +18 -52
- package/src/core/crypto/ed25519.ts +118 -104
- package/src/core/crypto/index.ts +6 -5
- package/src/core/crypto/multiEd25519.ts +98 -44
- package/src/core/crypto/multiKey.ts +192 -34
- package/src/core/crypto/privateKey.ts +25 -0
- package/src/core/crypto/publicKey.ts +52 -0
- package/src/core/crypto/secp256k1.ts +108 -111
- package/src/core/crypto/signature.ts +46 -0
- package/src/core/crypto/singleKey.ts +180 -0
- package/src/internal/account.ts +5 -3
- package/src/internal/digitalAsset.ts +26 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +0 -1
- package/src/transactions/authenticator/account.ts +1 -2
- package/src/transactions/instances/rotationProofChallenge.ts +1 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
- package/src/transactions/types.ts +1 -1
- package/src/utils/const.ts +0 -4
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
- package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
- package/dist/esm/chunk-7IGH7N52.mjs +0 -2
- package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
- package/dist/esm/chunk-CCUD52OF.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
- package/dist/esm/chunk-ENKMOALS.mjs.map +0 -1
- package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
- package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
- package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
- package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
- package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
- package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
- package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
- package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
- package/dist/esm/chunk-LHJSG5NE.mjs +0 -2
- package/dist/esm/chunk-LHJSG5NE.mjs.map +0 -1
- package/dist/esm/chunk-MEPX7Z2Z.mjs +0 -2
- package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
- package/dist/esm/chunk-S3FBGS3W.mjs +0 -2
- package/dist/esm/chunk-S3FBGS3W.mjs.map +0 -1
- package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
- package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
- package/dist/esm/chunk-SRZTA6QH.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
- package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
- package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
- package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
- package/dist/esm/chunk-XZYPAQCU.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs.map +0 -1
- package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
- package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
- package/dist/esm/core/account.d.mts +0 -184
- package/dist/esm/core/account.mjs +0 -2
- package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
- package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
- package/dist/esm/core/crypto/anySignature.d.mts +0 -31
- package/dist/esm/core/crypto/anySignature.mjs +0 -2
- package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
- package/src/core/account.ts +0 -282
- package/src/core/crypto/anyPublicKey.ts +0 -92
- package/src/core/crypto/anySignature.ts +0 -56
- package/src/core/crypto/asymmetricCrypto.ts +0 -77
- /package/dist/esm/{chunk-GD5TZLBF.mjs.map → chunk-27XWZ5HH.mjs.map} +0 -0
- /package/dist/esm/{chunk-VPQ46CAO.mjs.map → chunk-2CZ7RDU5.mjs.map} +0 -0
- /package/dist/esm/{chunk-SXIFL5DQ.mjs.map → chunk-2LRDOYKF.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7CR75CJ.mjs.map → chunk-3BWYI3KO.mjs.map} +0 -0
- /package/dist/esm/{chunk-GD4ULEBC.mjs.map → chunk-4H3C3V6D.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4UDMBMU.mjs.map → chunk-4M3DGBX6.mjs.map} +0 -0
- /package/dist/esm/{chunk-4OI7MPFH.mjs.map → chunk-AKBRO5YS.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7MOQC7Z.mjs.map → chunk-BMDNUQIP.mjs.map} +0 -0
- /package/dist/esm/{chunk-EUHPML5E.mjs.map → chunk-BR6FLUGH.mjs.map} +0 -0
- /package/dist/esm/{chunk-6SRENFWH.mjs.map → chunk-CARQVN57.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q5HK3U64.mjs.map → chunk-DGZIRX6Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-2DNPRIS5.mjs.map → chunk-DWRBQ52O.mjs.map} +0 -0
- /package/dist/esm/{chunk-XBVORX5O.mjs.map → chunk-DZNEBO5A.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3HAJVCM.mjs.map → chunk-FI2B5BQ2.mjs.map} +0 -0
- /package/dist/esm/{chunk-4M46AWXX.mjs.map → chunk-HE4FXVC4.mjs.map} +0 -0
- /package/dist/esm/{chunk-QKTV6AZ7.mjs.map → chunk-HZO2FSG5.mjs.map} +0 -0
- /package/dist/esm/{chunk-VRSUCKJA.mjs.map → chunk-IKKFQZDP.mjs.map} +0 -0
- /package/dist/esm/{chunk-SPOHAEHR.mjs.map → chunk-J2P6ERQF.mjs.map} +0 -0
- /package/dist/esm/{chunk-S64WKSMI.mjs.map → chunk-JOYBEFKL.mjs.map} +0 -0
- /package/dist/esm/{chunk-KJGQ4ILY.mjs.map → chunk-JW65YQSF.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIVJXLRM.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
- /package/dist/esm/{chunk-PJNPLRPR.mjs.map → chunk-L5WL2GGI.mjs.map} +0 -0
- /package/dist/esm/{chunk-QRQAR6XO.mjs.map → chunk-LF67MEQF.mjs.map} +0 -0
- /package/dist/esm/{chunk-AFPJ2XXN.mjs.map → chunk-M4DLGIKP.mjs.map} +0 -0
- /package/dist/esm/{chunk-7D5LHQNS.mjs.map → chunk-MX5RTG3J.mjs.map} +0 -0
- /package/dist/esm/{chunk-B2ZKW23W.mjs.map → chunk-NL6SHGNC.mjs.map} +0 -0
- /package/dist/esm/{core/account.mjs.map → chunk-QE4ASJ5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-M3WNE7MU.mjs.map → chunk-QT4YHSGZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-PMWH5IGI.mjs.map → chunk-QTKWCACE.mjs.map} +0 -0
- /package/dist/esm/{chunk-QGIJNA37.mjs.map → chunk-RD4HGTGK.mjs.map} +0 -0
- /package/dist/esm/{chunk-IHCIKE42.mjs.map → chunk-RG527TGB.mjs.map} +0 -0
- /package/dist/esm/{chunk-ENDUXRTK.mjs.map → chunk-RSV64IPI.mjs.map} +0 -0
- /package/dist/esm/{chunk-VKZCIGKY.mjs.map → chunk-SMND5Q5T.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4AKS4CY.mjs.map → chunk-TCXBCK5T.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIXE7MN5.mjs.map → chunk-UCA6JL25.mjs.map} +0 -0
- /package/dist/esm/{chunk-2WFMD6C6.mjs.map → chunk-UJB36GIR.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJ6Y35DF.mjs.map → chunk-V5AIOBTO.mjs.map} +0 -0
- /package/dist/esm/{chunk-PPTG6BDV.mjs.map → chunk-VRSSKMX4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-X2OCPM7P.mjs.map} +0 -0
- /package/dist/esm/{chunk-LATJGGVX.mjs.map → chunk-X34ZBPWT.mjs.map} +0 -0
- /package/dist/esm/{chunk-V2FPYAK7.mjs.map → chunk-XA37GN3W.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4RBQZ2B.mjs.map → chunk-XGWFFSQ6.mjs.map} +0 -0
- /package/dist/esm/{chunk-R56OJ4XC.mjs.map → chunk-YGW3VAPT.mjs.map} +0 -0
- /package/dist/esm/{chunk-2H5Z5EHH.mjs.map → chunk-YNSKIECV.mjs.map} +0 -0
- /package/dist/esm/{chunk-FRLPX47J.mjs.map → chunk-YXBNTR7V.mjs.map} +0 -0
- /package/dist/esm/{chunk-JQVT2K7G.mjs.map → chunk-ZSPPXKRC.mjs.map} +0 -0
- /package/dist/esm/core/{crypto/anySignature.mjs.map → account/Account.mjs.map} +0 -0
- /package/dist/esm/core/{crypto/asymmetricCrypto.mjs.map → account/Ed25519Account.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport { Account } from \"../../core/account\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"../../core/crypto/secp256k1\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport {\n DEFAULT_MAX_GAS_AMOUNT,\n DEFAULT_TXN_EXP_SEC_FROM_NOW,\n RAW_TRANSACTION_SALT,\n RAW_TRANSACTION_WITH_DATA_SALT,\n} from \"../../utils/const\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n AnyRawTransactionInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n SimpleTransaction,\n InputGenerateTransactionOptions,\n MultiAgentTransaction,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { AnyNumber } from \"../../types\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransactionPayload` function.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n const functionAbi = await memoizeAsync(\n async () => fetchEntryFunctionAbi(moduleAddress, moduleName, functionName, args.aptosConfig),\n `entry-function-${args.aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(Hex.fromHexInput(args.bytecode).toUint8Array(), args.typeArguments ?? [], args.functionArguments),\n );\n}\n\n/**\n * Generates a raw transaction\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n *\n * @returns RawTransaction\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n const getChainId = NetworkToChainId[aptosConfig.network]\n ? Promise.resolve({ chain_id: NetworkToChainId[aptosConfig.network] })\n : getLedgerInfo({ aptosConfig });\n\n const getGasUnitPrice = options?.gasUnitPrice\n ? Promise.resolve({ gas_estimate: options.gasUnitPrice })\n : getGasPriceEstimation({ aptosConfig });\n\n const [{ chain_id: chainId }, { gas_estimate: gasEstimate }] = await Promise.all([getChainId, getGasUnitPrice]);\n\n const getSequenceNumber =\n options?.accountSequenceNumber !== undefined\n ? Promise.resolve({ sequence_number: options.accountSequenceNumber })\n : getInfo({ aptosConfig, accountAddress: sender });\n\n let sequenceNumber: string | AnyNumber;\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n const { sequence_number: seqNumber } = await getSequenceNumber;\n sequenceNumber = seqNumber;\n } catch (e: any) {\n sequenceNumber = \"0\";\n }\n } else {\n const { sequence_number: seqNumber } = await getSequenceNumber;\n sequenceNumber = seqNumber;\n }\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: BigInt(gasEstimate),\n expireTimestamp: BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n ...options,\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransaction` function.\n * When we call our `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return {\n rawTransaction: rawTxn,\n secondarySignerAddresses: signers,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n }\n // return the raw transaction\n return {\n rawTransaction: rawTxn,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n}\n\n/**\n * Simulate a transaction before signing and submit to chain\n *\n * @param args.transaction A aptos transaction type to sign\n * @param args.signerPublicKey The signer public key\n * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction\n * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction\n * @param args.options optional. SimulateTransactionOptions\n *\n * @returns A signed serialized transaction that can be simulated\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey!);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys!.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (accountAuthenticator instanceof AccountAuthenticatorSingleKey) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\n // TODO add support for AnyMultiKey\n if (publicKey instanceof AnyPublicKey) {\n if (publicKey.publicKey instanceof Ed25519PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));\n }\n if (publicKey.publicKey instanceof Secp256k1PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));\n }\n }\n\n // legacy code\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(publicKey.toUint8Array()),\n new Ed25519Signature(new Uint8Array(64)),\n );\n}\n\n/**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction A aptos transaction type to sign\n *\n * @return The signer AccountAuthenticator\n */\nexport function sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // get the signing message\n const message = generateSigningMessage(transaction);\n\n // account.signMessage\n return signer.signWithAuthenticator(message);\n}\n\n/**\n * Prepare a transaction to be submitted to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @returns A SignedTransaction\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, senderAuthenticator, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n\n const transactionToSubmit = deriveTransactionType(transaction);\n\n if (\n (feePayerAuthenticator || additionalSignersAuthenticators) &&\n (transactionToSubmit instanceof MultiAgentRawTransaction || transactionToSubmit instanceof FeePayerRawTransaction)\n ) {\n return generateMultiSignersSignedTransaction(\n transactionToSubmit,\n senderAuthenticator,\n feePayerAuthenticator,\n additionalSignersAuthenticators,\n );\n }\n\n // submit single signer transaction\n\n // check what instance is accountAuthenticator\n if (senderAuthenticator instanceof AccountAuthenticatorEd25519 && transactionToSubmit instanceof RawTransaction) {\n const transactionAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n if (\n (senderAuthenticator instanceof AccountAuthenticatorSingleKey ||\n senderAuthenticator instanceof AccountAuthenticatorMultiKey) &&\n transactionToSubmit instanceof RawTransaction\n ) {\n const transactionAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot generate a signed transaction, ${senderAuthenticator} is not a supported account authentication scheme`,\n );\n}\n\n/**\n * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction\n *\n * @param transaction A aptos transaction type\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generate a multi signers signed transaction that can be submitted to chain\n *\n * @param transaction MultiAgentRawTransaction | FeePayerRawTransaction\n * @param senderAuthenticator The account authenticator of the transaction sender\n * @param secondarySignerAuthenticators The extra signers account Authenticators\n *\n * @returns A SignedTransaction\n */\nexport function generateMultiSignersSignedTransaction(\n transaction: MultiAgentRawTransaction | FeePayerRawTransaction,\n senderAuthenticator: AccountAuthenticator,\n feePayerAuthenticator?: AccountAuthenticator,\n additionalSignersAuthenticators?: Array<AccountAuthenticator>,\n) {\n if (transaction instanceof FeePayerRawTransaction) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n const txAuthenticatorFeePayer = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.fee_payer_address,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transaction.raw_txn, txAuthenticatorFeePayer).bcsToBytes();\n }\n if (transaction instanceof MultiAgentRawTransaction) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n const multiAgentAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n );\n return new SignedTransaction(transaction.raw_txn, multiAgentAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot prepare multi signers transaction to submission, ${typeof transaction} transaction is not supported`,\n );\n}\n\nexport function generateSigningMessage(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n const hash = sha3Hash.create();\n\n if (rawTxn instanceof RawTransaction) {\n hash.update(RAW_TRANSACTION_SALT);\n } else if (rawTxn instanceof MultiAgentRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else if (rawTxn instanceof FeePayerRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else {\n throw new Error(`Unknown transaction type to sign on: ${rawTxn}`);\n }\n\n const prefix = hash.digest();\n\n const body = rawTxn.bcsToBytes();\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n"],"mappings":"i6BAQA,OAAS,YAAYA,OAAg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CACF,EACA,OAAO,IAAIG,EAAkBZ,EAAY,QAASmC,CAAuB,EAAE,WAAW,CACxF,CACA,GAAInC,aAAuBa,EAA0B,CACnD,GAAI,CAACiB,EACH,MAAM,IAAI,MACR,sGACF,EAEF,IAAMM,EAA0B,IAAItB,EAClCe,EACA7B,EAAY,2BACZ8B,GAAmC,CAAC,CACtC,EACA,OAAO,IAAIlB,EAAkBZ,EAAY,QAASoC,CAAuB,EAAE,WAAW,CACxF,CAEA,MAAM,IAAI,MACR,2DAA2D,OAAOpC,CAAW,+BAC/E,CACF,CAEO,SAAS2B,GAAuB3B,EAA4C,CACjF,IAAML,EAASqC,GAAsBhC,CAAW,EAC1CqC,EAAOC,GAAS,OAAO,EAE7B,GAAI3C,aAAkBH,EACpB6C,EAAK,OAAOE,CAAoB,UACvB5C,aAAkBkB,EAC3BwB,EAAK,OAAOG,CAA8B,UACjC7C,aAAkBW,EAC3B+B,EAAK,OAAOG,CAA8B,MAE1C,OAAM,IAAI,MAAM,wCAAwC7C,CAAM,EAAE,EAGlE,IAAM8C,EAASJ,EAAK,OAAO,EAErBK,EAAO/C,EAAO,WAAW,EAEzBgD,EAAc,IAAI,WAAWF,EAAO,OAASC,EAAK,MAAM,EAC9D,OAAAC,EAAY,IAAIF,CAAM,EACtBE,EAAY,IAAID,EAAMD,EAAO,MAAM,EAE5BE,CACT","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","memoizeAsync","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultiSig","MultiSig","MultiSigTransactionPayload","TransactionPayloadEntryFunction","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","chainId","gasEstimate","getSequenceNumber","getInfo","sequenceNumber","seqNumber","maxGasAmount","gasUnitPrice","expireTimestamp","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","TransactionAuthenticatorSingleSender","AnyPublicKey","Ed25519PublicKey","AnySignature","Ed25519Signature","Secp256k1PublicKey","Secp256k1Signature","sign","message","generateSigningMessage","generateSignedTransaction","senderAuthenticator","additionalSignersAuthenticators","transactionToSubmit","deriveTransactionType","generateMultiSignersSignedTransaction","AccountAuthenticatorMultiKey","txAuthenticatorFeePayer","multiAgentAuthenticator","hash","sha3Hash","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","prefix","body","mergedArray"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as n}from"./chunk-2YB3QA6V.mjs";import{a as c}from"./chunk-53HSYUXO.mjs";import{b as i}from"./chunk-HK6O5AUH.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-637CGNKQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/account/Account.ts"],"sourcesContent":["import type { AccountAuthenticator } from \"../../transactions/authenticator/account\";\nimport { HexInput, SigningScheme, SigningSchemeInput } from \"../../types\";\nimport type { AccountAddress, AccountAddressInput } from \"../accountAddress\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountPublicKey, Ed25519PrivateKey, PrivateKey, Signature, VerifySignatureArgs } from \"../crypto\";\nimport { Ed25519Account } from \"./Ed25519Account\";\nimport { SingleKeyAccount } from \"./SingleKeyAccount\";\n\n/**\n * Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`.\n * This is the default input type when passing an `Ed25519PrivateKey`.\n * In order to use the SingleKey authentication scheme, `legacy` needs to be explicitly set to false.\n */\nexport interface CreateEd25519AccountFromPrivateKeyArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n legacy?: true;\n}\n\n/**\n * Arguments for creating an `SingleKeyAccount` from an `Ed25519PrivateKey`.\n * The `legacy` argument needs to be explicitly set to false in order to\n * use the `SingleKey` authentication scheme.\n */\nexport interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n legacy: false;\n}\n\n/**\n * Arguments for creating an `SingleKeyAccount` from any supported private key\n * that is not an `Ed25519PrivateKey`.\n * The `legacy` argument defaults to false and cannot be explicitly set to true.\n */\nexport interface CreateSingleKeyAccountFromPrivateKeyArgs {\n privateKey: Exclude<PrivateKey, Ed25519PrivateKey>;\n address?: AccountAddressInput;\n legacy?: false;\n}\n\n/**\n * Arguments for creating an opaque `Account` from any supported private key.\n * This is used when the private key type is not known at compilation time.\n */\nexport interface CreateAccountFromPrivateKeyArgs {\n privateKey: PrivateKey;\n address?: AccountAddressInput;\n legacy?: boolean;\n}\n\n/**\n * Arguments for generating an `Ed25519Account`.\n * This is the input type used by default.\n */\nexport interface GenerateEd25519AccountArgs {\n scheme?: SigningSchemeInput.Ed25519;\n legacy?: true;\n}\n\n/**\n * Arguments for generating an `SingleKeyAccount` with ah underlying `Ed25519PrivateKey`.\n * The `legacy` argument needs to be explicitly set to false,\n * otherwise an `Ed25519Account` will be returned instead.\n */\nexport interface GenerateEd25519SingleKeyAccountArgs {\n scheme?: SigningSchemeInput.Ed25519;\n legacy: false;\n}\n\n/**\n * Arguments for generating an `SingleKeyAccount` with any supported private key\n * that is not an `Ed25519PrivateKey`.\n * The `legacy` argument defaults to false and cannot be explicitly set to true.\n */\nexport interface GenerateSingleKeyAccountArgs {\n scheme: Exclude<SigningSchemeInput, SigningSchemeInput.Ed25519>;\n legacy?: false;\n}\n\n/**\n * Arguments for generating an opaque `Account`.\n * This is used when the input signature scheme is not known at compilation time.\n */\nexport interface GenerateAccountArgs {\n scheme?: SigningSchemeInput;\n legacy?: boolean;\n}\n\n/**\n * Arguments for deriving a private key from a mnemonic phrase and a BIP44 path.\n */\nexport interface PrivateKeyFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\n/**\n * Interface for a generic Aptos account.\n *\n * The interface is defined as abstract class to provide a single entrypoint for account generation,\n * either through `Account.generate()` or `Account.fromDerivationPath`.\n * Despite this being an abstract class, it should be treated as an interface and enforced using\n * the `implements` keyword.\n *\n * Note: Generating an account instance does not create the account on-chain.\n */\nexport abstract class Account {\n /**\n * Private key associated with the account.\n * Note: this will be removed in the next major release,\n * as not all accounts have a private key.\n */\n abstract readonly privateKey: PrivateKey;\n\n /**\n * Public key associated with the account\n */\n abstract readonly publicKey: AccountPublicKey;\n\n /**\n * Account address associated with the account\n */\n abstract readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n abstract signingScheme: SigningScheme;\n\n /**\n * Derives an account from a randomly generated private key.\n * @param args.scheme The signature scheme to use, to generate the private key\n * @param args.legacy Whether to use a legacy authentication scheme, when applicable\n * @returns An account compatible with the provided signature scheme\n */\n static generate(args?: GenerateEd25519AccountArgs): Ed25519Account;\n static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount;\n static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount;\n static generate(args: GenerateAccountArgs): Account;\n static generate(args: GenerateAccountArgs = {}) {\n const { scheme = SigningSchemeInput.Ed25519, legacy = true } = args;\n if (scheme === SigningSchemeInput.Ed25519 && legacy) {\n return Ed25519Account.generate();\n }\n return SingleKeyAccount.generate({ scheme });\n }\n\n /**\n * Creates an account from the provided private key.\n *\n * @param args.privateKey a valid private key\n * @param args.address the account's address. If not provided, it will be derived from the public key.\n * @param args.legacy Whether to use a legacy authentication scheme, when applicable\n */\n static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account;\n static fromPrivateKey(args: CreateEd25519SingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;\n static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;\n static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): Account;\n static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs) {\n const { privateKey, address, legacy = true } = args;\n if (privateKey instanceof Ed25519PrivateKey && legacy) {\n return new Ed25519Account({\n privateKey,\n address,\n });\n }\n return new SingleKeyAccount({ privateKey, address });\n }\n\n /**\n * @deprecated use `fromPrivateKey` instead.\n * Instantiates an account given a private key and a specified account address.\n * This is primarily used to instantiate an `Account` that has had its authentication key rotated.\n *\n * @param args.privateKey PrivateKey - the underlying private key for the account\n * @param args.address AccountAddress - The account address the `Account` will sign for\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs) {\n return this.fromPrivateKey(args);\n }\n\n /**\n * Derives an account with bip44 path and mnemonics\n *\n * @param args.scheme The signature scheme to derive the private key with\n * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,\n * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic the mnemonic seed phrase of the account\n */\n static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account;\n static fromDerivationPath(\n args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs,\n ): SingleKeyAccount;\n static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;\n static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account;\n static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs) {\n const { scheme = SigningSchemeInput.Ed25519, mnemonic, path, legacy = true } = args;\n if (scheme === SigningSchemeInput.Ed25519 && legacy) {\n return Ed25519Account.fromDerivationPath({ mnemonic, path });\n }\n return SingleKeyAccount.fromDerivationPath({ scheme, mnemonic, path });\n }\n\n /**\n * @deprecated use `publicKey.authKey()` instead.\n * This key enables account owners to rotate their private key(s)\n * associated with the account without changing the address that hosts their account.\n * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}\n *\n * @param args.publicKey PublicKey - public key of the account\n * @returns The authentication key for the associated account\n */\n static authKey(args: { publicKey: AccountPublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Sign a message using the available signing capabilities.\n * @param message the signing message, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n abstract signWithAuthenticator(message: HexInput): AccountAuthenticator;\n\n /**\n * Sign the given message with the private key.\n * @param message in HexInput format\n * @returns AccountSignature\n */\n abstract sign(message: HexInput): Signature;\n\n /**\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message signature\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n}\n"],"mappings":"2HA2GO,IAAeA,EAAf,KAAuB,CAiC5B,OAAO,SAASC,EAA4B,CAAC,EAAG,CAC9C,GAAM,CAAE,OAAAC,IAAqC,OAAAC,EAAS,EAAK,EAAIF,EAC/D,OAAIC,IAAW,GAA8BC,EACpCC,EAAe,SAAS,EAE1BC,EAAiB,SAAS,CAAE,OAAAH,CAAO,CAAC,CAC7C,CAaA,OAAO,eAAeD,EAAuC,CAC3D,GAAM,CAAE,WAAAK,EAAY,QAAAC,EAAS,OAAAJ,EAAS,EAAK,EAAIF,EAC/C,OAAIK,aAAsBE,GAAqBL,EACtC,IAAIC,EAAe,CACxB,WAAAE,EACA,QAAAC,CACF,CAAC,EAEI,IAAIF,EAAiB,CAAE,WAAAC,EAAY,QAAAC,CAAQ,CAAC,CACrD,CAcA,OAAO,yBAAyBN,EAAuC,CACrE,OAAO,KAAK,eAAeA,CAAI,CACjC,CAiBA,OAAO,mBAAmBA,EAA8D,CACtF,GAAM,CAAE,OAAAC,IAAqC,SAAAO,EAAU,KAAAC,EAAM,OAAAP,EAAS,EAAK,EAAIF,EAC/E,OAAIC,IAAW,GAA8BC,EACpCC,EAAe,mBAAmB,CAAE,SAAAK,EAAU,KAAAC,CAAK,CAAC,EAEtDL,EAAiB,mBAAmB,CAAE,OAAAH,EAAQ,SAAAO,EAAU,KAAAC,CAAK,CAAC,CACvE,CAWA,OAAO,QAAQT,EAA0D,CACvE,GAAM,CAAE,UAAAU,CAAU,EAAIV,EACtB,OAAOU,EAAU,QAAQ,CAC3B,CAoBA,gBAAgBV,EAAoC,CAClD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CACF","names":["Account","args","scheme","legacy","Ed25519Account","SingleKeyAccount","privateKey","address","Ed25519PrivateKey","mnemonic","path","publicKey"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p,b as g}from"./chunk-ODSW4WOX.mjs";import{a as A}from"./chunk-3FGD73JA.mjs";import{a as h,b as o}from"./chunk-G542XORT.mjs";import{a as d,c as b}from"./chunk-HK6O5AUH.mjs";import{a as y}from"./chunk-XGWFFSQ6.mjs";var n=class extends y{static deserialize(t){let i=t.deserializeUleb128AsU32();switch(i){case 0:return a.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return c.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${i}`)}}isEd25519(){return this instanceof a}isMultiEd25519(){return this instanceof u}isSingleKey(){return this instanceof l}isMultiKey(){return this instanceof c}},a=class r extends n{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(0),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=d.deserialize(i),s=b.deserialize(i);return new r(e,s)}},u=class r extends n{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(1),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=p.deserialize(i),s=g.deserialize(i);return new r(e,s)}},l=class r extends n{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(2),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=h.deserialize(i),s=o.deserialize(i);return new r(e,s)}},c=class r extends n{constructor(i,e,s){super();this.public_keys=i,this.signatures=e,this.signatures_bitmap=s}serialize(i){i.serializeU32AsUleb128(3),this.public_keys.serialize(i),i.serializeVector(this.signatures),i.serializeBytes(this.signatures_bitmap)}static load(i){let e=A.deserialize(i),s=i.deserializeVector(o),z=i.deserializeBytes();return new r(e,s,z)}};export{n as a,a as b,u as c,l as d,c as e};
|
|
2
|
+
//# sourceMappingURL=chunk-6CSXIJR4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/authenticator/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Serializer, Deserializer, Serializable } from \"../../bcs\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { MultiKey } from \"../../core/crypto/multiKey\";\nimport { AccountAuthenticatorVariant } from \"../../types\";\n\nexport abstract class AccountAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n static deserialize(deserializer: Deserializer): AccountAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AccountAuthenticatorVariant.Ed25519:\n return AccountAuthenticatorEd25519.load(deserializer);\n case AccountAuthenticatorVariant.MultiEd25519:\n return AccountAuthenticatorMultiEd25519.load(deserializer);\n case AccountAuthenticatorVariant.SingleKey:\n return AccountAuthenticatorSingleKey.load(deserializer);\n case AccountAuthenticatorVariant.MultiKey:\n return AccountAuthenticatorMultiKey.load(deserializer);\n default:\n throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);\n }\n }\n\n isEd25519(): this is AccountAuthenticatorEd25519 {\n return this instanceof AccountAuthenticatorEd25519;\n }\n\n isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {\n return this instanceof AccountAuthenticatorMultiEd25519;\n }\n\n isSingleKey(): this is AccountAuthenticatorSingleKey {\n return this instanceof AccountAuthenticatorSingleKey;\n }\n\n isMultiKey(): this is AccountAuthenticatorMultiKey {\n return this instanceof AccountAuthenticatorMultiKey;\n }\n}\n\n/**\n * Transaction authenticator Ed25519 for a multi signer transaction\n *\n * @param public_key Account's Ed25519 public key.\n * @param signature Account's Ed25519 signature\n *\n */\nexport class AccountAuthenticatorEd25519 extends AccountAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Transaction authenticator Multi Ed25519 for a multi signers transaction\n *\n * @param public_key Account's MultiEd25519 public key.\n * @param signature Account's MultiEd25519 signature\n *\n */\nexport class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * AccountAuthenticatorSingleKey for a single signer\n *\n * @param public_key AnyPublicKey\n * @param signature AnySignature\n *\n */\nexport class AccountAuthenticatorSingleKey extends AccountAuthenticator {\n public readonly public_key: AnyPublicKey;\n\n public readonly signature: AnySignature;\n\n constructor(public_key: AnyPublicKey, signature: AnySignature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.SingleKey);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorSingleKey {\n const public_key = AnyPublicKey.deserialize(deserializer);\n const signature = AnySignature.deserialize(deserializer);\n return new AccountAuthenticatorSingleKey(public_key, signature);\n }\n}\n\n/**\n * AccountAuthenticatorMultiKey for a multi signer\n *\n * @param public_keys MultiKey\n * @param signatures Signature\n *\n */\nexport class AccountAuthenticatorMultiKey extends AccountAuthenticator {\n public readonly public_keys: MultiKey;\n\n public readonly signatures: Array<AnySignature>;\n\n public readonly signatures_bitmap: Uint8Array;\n\n constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array) {\n super();\n this.public_keys = public_keys;\n this.signatures = signatures;\n this.signatures_bitmap = signatures_bitmap;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);\n this.public_keys.serialize(serializer);\n serializer.serializeVector<AnySignature>(this.signatures);\n serializer.serializeBytes(this.signatures_bitmap);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {\n const public_keys = MultiKey.deserialize(deserializer);\n const signatures = deserializer.deserializeVector(AnySignature);\n const signatures_bitmap = deserializer.deserializeBytes();\n return new AccountAuthenticatorMultiKey(public_keys, signatures, signatures_bitmap);\n }\n}\n"],"mappings":"kOAYO,IAAeA,EAAf,cAA4CC,CAAa,CAG9D,OAAO,YAAYC,EAAkD,CACnE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAA4B,KAAKF,CAAY,EACtD,OACE,OAAOG,EAAiC,KAAKH,CAAY,EAC3D,OACE,OAAOI,EAA8B,KAAKJ,CAAY,EACxD,OACE,OAAOK,EAA6B,KAAKL,CAAY,EACvD,QACE,MAAM,IAAI,MAAM,mDAAmDC,CAAK,EAAE,CAC9E,CACF,CAEA,WAAiD,CAC/C,OAAO,gBAAgBC,CACzB,CAEA,gBAA2D,CACzD,OAAO,gBAAgBC,CACzB,CAEA,aAAqD,CACnD,OAAO,gBAAgBC,CACzB,CAEA,YAAmD,CACjD,OAAO,gBAAgBC,CACzB,CACF,EASaH,EAAN,MAAMI,UAAoCR,CAAqB,CAKpE,YAAYS,EAA8BC,EAA6B,CACrE,MAAM,EACN,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CAC3B,CAEA,UAAUZ,EAA8B,CACtCA,EAAW,uBAA0D,EACrE,KAAK,YAAY,UAAUA,CAAU,EACrCA,EAAW,gBAA8B,KAAK,UAAU,EACxDA,EAAW,eAAe,KAAK,iBAAiB,CAClD,CAEA,OAAO,KAAKT,EAA0D,CACpE,IAAMmB,EAAcG,EAAS,YAAYtB,CAAY,EAC/CoB,EAAapB,EAAa,kBAAkBiB,CAAY,EACxDI,EAAoBrB,EAAa,iBAAiB,EACxD,OAAO,IAAIkB,EAA6BC,EAAaC,EAAYC,CAAiB,CACpF,CACF","names":["AccountAuthenticator","Serializable","deserializer","index","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","_AccountAuthenticatorEd25519","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","_AccountAuthenticatorMultiEd25519","MultiEd25519PublicKey","MultiEd25519Signature","_AccountAuthenticatorSingleKey","AnyPublicKey","AnySignature","_AccountAuthenticatorMultiKey","public_keys","signatures","signatures_bitmap","MultiKey"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-NL6SHGNC.mjs";import{a,b as g,c as f}from"./chunk-BMDNUQIP.mjs";import{a as o,b as u,c as s,d as c,e as p,f as y,g as m}from"./chunk-IKKFQZDP.mjs";import{b as r}from"./chunk-3BWYI3KO.mjs";function M(n){return typeof n=="boolean"}function D(n){return typeof n=="string"}function N(n){return typeof n=="number"}function P(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function w(n){return n==null}function G(n){return A(n)||x(n)||S(n)||B(n)||U(n)||I(n)||b(n)||T(n)||E(n)||d(n)||n instanceof a||n instanceof f}function A(n){return n instanceof o}function T(n){return n instanceof r}function E(n){return n instanceof g}function d(n){return n instanceof i}function x(n){return n instanceof u}function S(n){return n instanceof s}function B(n){return n instanceof c}function U(n){return n instanceof p}function I(n){return n instanceof y}function b(n){return n instanceof m}function $(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],l=t[2];return{moduleAddress:e,moduleName:F,functionName:l}}export{M as a,D as b,N as c,P as d,w as e,G as f,A as g,T as h,E as i,d as j,x as k,S as l,B as m,U as n,I as o,b as p,$ as q,R as r,W as s,L as t};
|
|
2
|
+
//# sourceMappingURL=chunk-AKBRO5YS.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l,b as s,c as u,d as c,e as d,f as m,g as U}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l,b as s,c as u,d as c,e as d,f as m,g as U}from"./chunk-IKKFQZDP.mjs";import{a as o}from"./chunk-XGWFFSQ6.mjs";import{b as z}from"./chunk-NL72WE3E.mjs";var t=class n extends o{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof s)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=z.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(i=>new s(i)))}static U16(e){return new n(e.map(r=>new u(r)))}static U32(e){return new n(e.map(r=>new c(r)))}static U64(e){return new n(e.map(r=>new d(r)))}static U128(e){return new n(e.map(r=>new m(r)))}static U256(e){return new n(e.map(r=>new U(r)))}static Bool(e){return new n(e.map(r=>new l(r)))}static MoveString(e){return new n(e.map(r=>new a(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),y=new Array;for(let w=0;w<i;w+=1)y.push(r.deserialize(e));return new n(y)}},a=class n extends o{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);t.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},f=class n extends o{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new t([e]):this.vec=new t([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new s(e):void 0)}static U16(e){return new n(e!=null?new u(e):void 0)}static U32(e){return new n(e!=null?new c(e):void 0)}static U64(e){return new n(e!=null?new d(e):void 0)}static U128(e){return new n(e!=null?new m(e):void 0)}static U256(e){return new n(e!=null?new U(e):void 0)}static Bool(e){return new n(e!=null?new l(e):void 0)}static MoveString(e){return new n(e!=null?new a(e):void 0)}static deserialize(e,r){let i=t.deserialize(e,r);return new n(i.values[0])}};export{t as a,a as b,f as c};
|
|
2
|
+
//# sourceMappingURL=chunk-BMDNUQIP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-RSV64IPI.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BR6FLUGH.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i,b as t,c as n,d as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i,b as t,c as n,d as o}from"./chunk-DZNEBO5A.mjs";import{a as s}from"./chunk-HE4FXVC4.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await i({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CARQVN57.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-3BWYI3KO.mjs";import{g as n}from"./chunk-QTKWCACE.mjs";import{p as g,u as d}from"./chunk-S4SEFF4K.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
|
|
2
|
+
//# sourceMappingURL=chunk-DGZIRX6Z.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r}from"./chunk-RSV64IPI.mjs";import{f as t,i as o}from"./chunk-L5WL2GGI.mjs";import{e as n}from"./chunk-HEPV52CH.mjs";var u={typeParameters:[{constraints:[]}],parameters:[new o,new t]};async function y(e){let{aptosConfig:i,sender:s,recipient:c,amount:a,coinType:p,options:m}=e;return r({aptosConfig:i,sender:s,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[p??n],functionArguments:[c,a],abi:u},options:m})}export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DWRBQ52O.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-RSV64IPI.mjs";import{c}from"./chunk-2LRDOYKF.mjs";import{f as g,i as A}from"./chunk-L5WL2GGI.mjs";import{g as o}from"./chunk-QTKWCACE.mjs";import{o as a,r,s as u}from"./chunk-S4SEFF4K.mjs";async function h(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 M(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 x(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 v(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:p,options:f}=t;return l({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,p],abi:b},options:f})}export{h as a,M as b,x as c,v as d};
|
|
2
|
+
//# sourceMappingURL=chunk-DZNEBO5A.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-3BWYI3KO.mjs";import{g as a}from"./chunk-QTKWCACE.mjs";import{q as d}from"./chunk-S4SEFF4K.mjs";var g=300,y=o=>{if(o&&o.length>g)throw new Error(`Event type length exceeds the maximum length of ${g}`)};async function f(o){let{aptosConfig:n,eventType:e,options:t}=o,r={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:t,orderBy:t?.orderBy};return c({aptosConfig:n,options:r})}async function h(o){let{accountAddress:n,aptosConfig:e,creationNumber:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},creation_number:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function _(o){let{accountAddress:n,aptosConfig:e,eventType:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},indexed_type:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function c(o){let{aptosConfig:n,options:e}=o;y(e?.where?.indexed_type?._eq);let t={query:d,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await a({aptosConfig:n,query:t,originMethod:"getEvents"})).events}export{f as a,h as b,_ as c,c as d};
|
|
2
|
+
//# sourceMappingURL=chunk-FI2B5BQ2.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t,b as r,c as o}from"./chunk-77SKA4HT.mjs";import i from"@aptos-labs/aptos-client";var n=class{constructor(e){this.network=e?.network??"devnet",this.fullnode=e?.fullnode,this.faucet=e?.faucet,this.indexer=e?.indexer,this.client=e?.client??{provider:i},this.clientConfig=e?.clientConfig??{}}getRequestUrl(e){switch(e){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return r[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return o[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return t[this.network];default:throw Error(`apiType ${e} is not supported`)}}isIndexerRequest(e){return t[this.network]===e}isFullnodeRequest(e){return r[this.network]===e}isFaucetRequest(e){return o[this.network]===e}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FWDKABRW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/aptosConfig.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport aptosClient from \"@aptos-labs/aptos-client\";\nimport { AptosSettings, ClientConfig, Client } from \"../types\";\nimport { NetworkToNodeAPI, NetworkToFaucetAPI, NetworkToIndexerAPI, Network } from \"../utils/apiEndpoints\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * This class holds the config information for the SDK client instance.\n */\nexport class AptosConfig {\n /** The Network that this SDK is associated with. Defaults to DEVNET */\n readonly network: Network;\n\n /**\n * The client instance the SDK uses. Defaults to `@aptos-labs/aptos-client\n */\n readonly client: Client;\n\n /**\n * The optional hardcoded fullnode URL to send requests to instead of using the network\n */\n readonly fullnode?: string;\n\n /**\n * The optional hardcoded faucet URL to send requests to instead of using the network\n */\n readonly faucet?: string;\n\n /**\n * The optional hardcoded indexer URL to send requests to instead of using the network\n */\n readonly indexer?: string;\n\n readonly clientConfig?: ClientConfig;\n\n constructor(settings?: AptosSettings) {\n this.network = settings?.network ?? Network.DEVNET;\n this.fullnode = settings?.fullnode;\n this.faucet = settings?.faucet;\n this.indexer = settings?.indexer;\n this.client = settings?.client ?? { provider: aptosClient };\n this.clientConfig = settings?.clientConfig ?? {};\n }\n\n /**\n * Returns the URL endpoint to send the request to.\n * If a custom URL was provided in the config, that URL is returned.\n * If a custom URL was provided but not URL endpoints, an error is thrown.\n * Otherwise, the URL endpoint is derived from the network.\n *\n * @param apiType - The type of Aptos API to get the URL for.\n *\n * @internal\n */\n getRequestUrl(apiType: AptosApiType): string {\n switch (apiType) {\n case AptosApiType.FULLNODE:\n if (this.fullnode !== undefined) return this.fullnode;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom full node url\");\n return NetworkToNodeAPI[this.network];\n case AptosApiType.FAUCET:\n if (this.faucet !== undefined) return this.faucet;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom faucet url\");\n return NetworkToFaucetAPI[this.network];\n case AptosApiType.INDEXER:\n if (this.indexer !== undefined) return this.indexer;\n if (this.network === Network.CUSTOM) throw new Error(\"Please provide a custom indexer url\");\n return NetworkToIndexerAPI[this.network];\n default:\n throw Error(`apiType ${apiType} is not supported`);\n }\n }\n\n /**\n * Checks if the URL is a known indexer endpoint\n *\n * @internal\n * */\n isIndexerRequest(url: string): boolean {\n return NetworkToIndexerAPI[this.network] === url;\n }\n\n /**\n * Checks if the URL is a known fullnode endpoint\n *\n * @internal\n * */\n isFullnodeRequest(url: string): boolean {\n return NetworkToNodeAPI[this.network] === url;\n }\n\n /**\n * Checks if the URL is a known faucet endpoint\n *\n * @internal\n * */\n isFaucetRequest(url: string): boolean {\n return NetworkToFaucetAPI[this.network] === url;\n }\n}\n"],"mappings":"uDAGA,OAAOA,MAAiB,2BAQjB,IAAMC,EAAN,KAAkB,CA0BvB,YAAYC,EAA0B,CACpC,KAAK,QAAUA,GAAU,kBACzB,KAAK,SAAWA,GAAU,SAC1B,KAAK,OAASA,GAAU,OACxB,KAAK,QAAUA,GAAU,QACzB,KAAK,OAASA,GAAU,QAAU,CAAE,SAAUC,CAAY,EAC1D,KAAK,aAAeD,GAAU,cAAgB,CAAC,CACjD,CAYA,cAAcE,EAA+B,CAC3C,OAAQA,EAAS,CACf,OACE,GAAI,KAAK,WAAa,OAAW,OAAO,KAAK,SAC7C,GAAI,KAAK,mBAA4B,MAAM,IAAI,MAAM,uCAAuC,EAC5F,OAAOC,EAAiB,KAAK,OAAO,EACtC,OACE,GAAI,KAAK,SAAW,OAAW,OAAO,KAAK,OAC3C,GAAI,KAAK,mBAA4B,MAAM,IAAI,MAAM,oCAAoC,EACzF,OAAOC,EAAmB,KAAK,OAAO,EACxC,OACE,GAAI,KAAK,UAAY,OAAW,OAAO,KAAK,QAC5C,GAAI,KAAK,mBAA4B,MAAM,IAAI,MAAM,qCAAqC,EAC1F,OAAOC,EAAoB,KAAK,OAAO,EACzC,QACE,MAAM,MAAM,WAAWH,CAAO,mBAAmB,CACrD,CACF,CAOA,iBAAiBI,EAAsB,CACrC,OAAOD,EAAoB,KAAK,OAAO,IAAMC,CAC/C,CAOA,kBAAkBA,EAAsB,CACtC,OAAOH,EAAiB,KAAK,OAAO,IAAMG,CAC5C,CAOA,gBAAgBA,EAAsB,CACpC,OAAOF,EAAmB,KAAK,OAAO,IAAME,CAC9C,CACF","names":["aptosClient","AptosConfig","settings","aptosClient","apiType","NetworkToNodeAPI","NetworkToFaucetAPI","NetworkToIndexerAPI","url"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,c}from"./chunk-L6NGU7XZ.mjs";import{a as n,c as s}from"./chunk-HK6O5AUH.mjs";import{b as l}from"./chunk-5VWG45IO.mjs";import{a as y}from"./chunk-3E4BKDQU.mjs";import{a as u}from"./chunk-HWL7DK5X.mjs";var b=class t extends l{constructor(e){super();if(this.publicKey=e,e instanceof n)this.variant=0;else if(e instanceof a)this.variant=1;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof o?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return u.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=n.deserialize(e);break;case 1:i=a.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new t(i)}static isPublicKey(e){return e instanceof t}isEd25519(){return this.publicKey instanceof n}isSecp256k1PublicKey(){return this.publicKey instanceof a}},o=class t extends y{constructor(e){super();if(this.signature=e,e instanceof s)this.variant=0;else if(e instanceof c)this.variant=1;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=s.deserialize(e);break;case 1:i=c.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new t(i)}};export{b as a,o as b};
|
|
2
|
+
//# sourceMappingURL=chunk-G542XORT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof AnySignature)) {\n return false;\n }\n\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof AnyPublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n}\n\n/**\n * Instance of signature that uses the SingleKey authentication scheme.\n * This signature can only be generated by a `SingleKeySigner`, since it uses the\n * same authentication scheme.\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n}\n"],"mappings":"iNAgBO,IAAMA,EAAN,MAAMC,UAAqBC,CAAiB,CAajD,YAAYC,EAAsB,CAChC,MAAM,EACN,QAAK,UAAYA,EACbA,aAAqBC,EACvB,KAAK,QAAU,UACND,aAAqBE,E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,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDJ,EACJ,OAAQK,EAAc,CACpB,OACEL,EAAYQ,EAAiB,YAAYJ,CAAY,EACrD,MACF,OACEJ,EAAYS,EAAmB,YAAYL,CAAY,EACvD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIC,EAAaN,CAAS,CACnC,CAGF","names":["AnyPublicKey","_AnyPublicKey","AccountPublicKey","publicKey","Ed25519PublicKey","Secp256k1PublicKey","args","message","signature","AnySignature","AuthenticationKey","serializer","deserializer","variantIndex","_AnySignature","Signature","Ed25519Signature","Secp256k1Signature"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as e}from"./chunk-ODJTKMBB.mjs";async function i(o){o.minimumLedgerVersion!==void 0&&await e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:o.processorType})}export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HE4FXVC4.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var O=(S=>(S[S.FULLNODE=0]="FULLNODE",S[S.INDEXER=1]="INDEXER",S[S.FAUCET=2]="FAUCET",S))(O||{}),t=2e5,R=20,n=20,N="0x1::aptos_coin::AptosCoin",T="APTOS::RawTransaction",o="APTOS::RawTransactionWithData",E=(_=>(_.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",_.DEFAULT="default_processor",_.EVENTS_PROCESSOR="events_processor",_.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",_.STAKE_PROCESSOR="stake_processor",_.TOKEN_V2_PROCESSOR="token_v2_processor",_.USER_TRANSACTION_PROCESSOR="user_transaction_processor",_))(E||{});export{O as a,t as b,R as c,n as d,N as e,T as f,o as g,E as h};
|
|
2
|
+
//# sourceMappingURL=chunk-HEPV52CH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/const.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Type of API endpoint for request routing\n */\nexport enum AptosApiType {\n FULLNODE,\n INDEXER,\n FAUCET,\n}\n\n/**\n * The default max gas amount when none is given.\n *\n * This is the maximum number of gas units that will be used by a transaction before being rejected.\n *\n * Note that max gas amount varies based on the transaction. A larger transaction will go over this\n * default gas amount, and the value will need to be changed for the specific transaction.\n */\nexport const DEFAULT_MAX_GAS_AMOUNT = 200000;\n\n/**\n * The default transaction expiration seconds from now.\n *\n * This time is how long until the blockchain nodes will reject the transaction.\n *\n * Note that the transaction expiration time varies based on network connection and network load. It may need to be\n * increased for the transaction to be processed.\n */\nexport const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20;\n\n/**\n * The default number of seconds to wait for a transaction to be processed.\n *\n * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for\n * the results of the transaction. It may take longer based on network connection and network load.\n */\nexport const DEFAULT_TXN_TIMEOUT_SEC = 20;\n\n/**\n * The default gas currency for the network.\n */\nexport const APTOS_COIN = \"0x1::aptos_coin::AptosCoin\";\n\nexport const RAW_TRANSACTION_SALT = \"APTOS::RawTransaction\";\nexport const RAW_TRANSACTION_WITH_DATA_SALT = \"APTOS::RawTransactionWithData\";\n\n/**\n * The list of supported Processor types for our indexer api.\n *\n * These can be found from the processor_status table in the indexer database.\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql}\n */\nexport enum ProcessorType {\n ACCOUNT_TRANSACTION_PROCESSOR = \"account_transactions_processor\",\n DEFAULT = \"default_processor\",\n EVENTS_PROCESSOR = \"events_processor\",\n // Fungible asset processor also handles coins\n FUNGIBLE_ASSET_PROCESSOR = \"fungible_asset_processor\",\n STAKE_PROCESSOR = \"stake_processor\",\n // Token V2 processor replaces Token processor (not only for digital assets)\n TOKEN_V2_PROCESSOR = \"token_v2_processor\",\n USER_TRANSACTION_PROCESSOR = \"user_transaction_processor\",\n}\n"],"mappings":"AAMO,IAAKA,OACVA,IAAA,uBACAA,IAAA,qBACAA,IAAA,mBAHUA,OAAA,IAcCC,EAAyB,IAUzBC,EAA+B,GAQ/BC,EAA0B,GAK1BC,EAAa,6BAEbC,EAAuB,wBACvBC,EAAiC,gCAQlCC,OACVA,EAAA,8BAAgC,iCAChCA,EAAA,QAAU,oBACVA,EAAA,iBAAmB,mBAEnBA,EAAA,yBAA2B,2BAC3BA,EAAA,gBAAkB,kBAElBA,EAAA,mBAAqB,qBACrBA,EAAA,2BAA6B,6BATnBA,OAAA","names":["AptosApiType","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","DEFAULT_TXN_TIMEOUT_SEC","APTOS_COIN","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","ProcessorType"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.
|
|
1
|
+
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.9.1\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as v}from"./chunk-5VWG45IO.mjs";import{a as S}from"./chunk-3E4BKDQU.mjs";import{d as f,f as K,g as A,h as H,i as P,j as E}from"./chunk-LR65XHSF.mjs";import{a as p}from"./chunk-HWL7DK5X.mjs";import{a as h}from"./chunk-XGWFFSQ6.mjs";import{b as i}from"./chunk-NL72WE3E.mjs";import o from"tweetnacl";var n=class n extends v{constructor(e){super();let t=i.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:s}=e;if(!(s instanceof y))return!1;let c=i.fromHexInput(t).toUint8Array(),u=s.toUint8Array(),l=this.key.toUint8Array();return o.sign.detached.verify(c,u,l)}authKey(){return p.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static isPublicKey(e){return e instanceof n}};n.LENGTH=32;var m=n,r=class r extends h{constructor(e){super();let t=i.fromHexInput(e);if(t.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKeyPair=o.sign.keyPair.fromSeed(t.toUint8Array().slice(0,r.LENGTH))}static generate(){let e=o.sign.keyPair();return new r(e.secretKey.slice(0,r.LENGTH))}static fromDerivationPath(e,t){if(!K(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,E(t))}static fromDerivationPathInner(e,t,s=f){let{key:c,chainCode:u}=A(r.SLIP_0010_SEED,t),l=P(e).map(d=>parseInt(d,10)),{key:U}=l.reduce((d,z)=>H(d,z+s),{key:c,chainCode:u});return new r(U)}publicKey(){let e=this.signingKeyPair.publicKey;return new m(e)}sign(e){let t=i.fromHexInput(e).toUint8Array(),s=o.sign.detached(t,this.signingKeyPair.secretKey);return new y(s)}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,r.LENGTH)}toString(){return i.fromHexInput(this.toUint8Array()).toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";var x=r,a=class a extends S{constructor(e){super();let t=i.fromHexInput(e);if(t.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new a(t)}};a.LENGTH=64;var y=a;export{m as a,x as b,y as c};
|
|
2
|
+
//# sourceMappingURL=chunk-HK6O5AUH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport nacl from \"tweetnacl\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n */\n private readonly key: Hex;\n\n /**\n * Create a new PublicKey instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed data with a public key\n * @param args.message a signed message\n * @param args.signature the signature of the message\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof Ed25519Signature)) {\n return false;\n }\n\n const messageBytes = Hex.fromHexInput(message).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return nacl.sign.detached.verify(messageBytes, signatureBytes, publicKeyBytes);\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n */\n private readonly signingKeyPair: nacl.SignKeyPair;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * @param hexInput HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const privateKeyHex = Hex.fromHexInput(hexInput);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKeyPair = nacl.sign.keyPair.fromSeed(privateKeyHex.toUint8Array().slice(0, Ed25519PrivateKey.LENGTH));\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = nacl.sign.keyPair();\n return new Ed25519PrivateKey(keyPair.secretKey.slice(0, Ed25519PrivateKey.LENGTH));\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase.\n *\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism,\n * so non-hardened derivation cannot work)\n *\n * @param path the BIP44 path\n * @param mnemonics the mnemonic seed phrase\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path the BIP44 path\n * @param seed the seed phrase created by the mnemonics\n * @param offset the offset used for key derivation, defaults to 0x80000000\n * @returns\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey\n */\n publicKey(): Ed25519PublicKey {\n const bytes = this.signingKeyPair.publicKey;\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n *\n * @param message in HexInput format\n * @returns Signature\n */\n sign(message: HexInput): Ed25519Signature {\n const messageBytes = Hex.fromHexInput(message).toUint8Array();\n const signatureBytes = nacl.sign.detached(messageBytes, this.signingKeyPair.secretKey);\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n */\n toUint8Array(): Uint8Array {\n return this.signingKeyPair.secretKey.slice(0, Ed25519PrivateKey.LENGTH);\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key\n */\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Ed25519PrivateKey` instead.\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * A signature of a message signed using an Ed25519 private key\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"yRAGA,OAAOA,MAAU,YAoBV,IAAMC,EAAN,MAAMA,UAAyBC,CAAiB,CAiBrD,YAAYC,EAAoB,CAC9B,MAAM,EAEN,IAAMC,EAAMC,EAAI,aAAaF,CAAQ,EACrC,GAAIC,EAAI,aAAa,EAAE,SAAWH,EAAiB,OACjD,MAAM,IAAI,MAAM,8BAA8BA,EAAiB,MAAM,EAAE,EAEzE,KAAK,IAAMG,CACb,CASA,gBAAgBE,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,GAAI,EAAEE,aAAqBC,GACzB,MAAO,GAGT,IAAMC,EAAeL,EAAI,aAAaE,CAAO,EAAE,aAAa,EACtDI,EAAiBH,EAAU,aAAa,EACxCI,EAAiB,KAAK,IAAI,aAAa,EAC7C,OAAOC,EAAK,KAAK,SAAS,OAAOH,EAAcC,EAAgBC,CAAc,CAC/E,CAEA,SAA6B,CAC3B,OAAOE,EAAkB,mBAAmB,CAC1C,SACA,MAAO,KAAK,aAAa,CAC3B,CAAC,CACH,CAOA,cAA2B,CACzB,OAAO,KAAK,IAAI,aAAa,CAC/B,CAMA,UAAUC,EAA8B,CACtCA,EAAW,eAAe,KAAK,IAAI,aAAa,CAAC,CACnD,CAEA,OAAO,YAAYC,EAA8C,CAC/D,IAAMC,EAAQD,EAAa,iBAAiB,EAC5C,OAAO,IAAIf,EAAiBgB,CAAK,CACnC,CAOA,OAAO,YAAYC,EAA4D,CAC7E,OAAOA,aAAqBjB,CAC9B,CACF,EAnFaA,EAIK,OAAiB,GAJ5B,IAAMkB,EAANlB,EAwFMmB,EAAN,MAAMA,UAA0BC,CAAmC,CAyBxE,YAAYlB,EAAoB,CAC9B,MAAM,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,KAAK,eAAe,UAAU,MAAM,EAAGS,EAAkB,MAAM,CACxE,CAOA,UAAmB,CACjB,OAAOf,EAAI,aAAa,KAAK,aAAa,CAAC,EAAE,SAAS,CACxD,CAMA,UAAUU,EAA8B,CACtCA,EAAW,eAAe,KAAK,aAAa,CAAC,CAC/C,CAEA,OAAO,YAAYC,EAA+C,CAChE,IAAMC,EAAQD,EAAa,iBAAiB,EAC5C,OAAO,IAAII,EAAkBH,CAAK,CACpC,CAOA,OAAO,aAAaoB,EAAyD,CAC3E,OAAOA,aAAsBjB,CAC/B,CACF,EAxJaA,EAIK,OAAiB,GAJtBA,EAUK,eAAiB,eAV5B,IAAMqB,EAANrB,EA6JMsB,EAAN,MAAMA,UAAyBC,CAAU,CAc9C,YAAYxC,EAAoB,CAC9B,MAAM,EACN,IAAMyC,EAAOvC,EAAI,aAAaF,CAAQ,EACtC,GAAIyC,EAAK,aAAa,EAAE,SAAWF,EAAiB,OAClD,MAAM,IAAI,MAAM,8BAA8BA,EAAiB,MAAM,EAAE,EAEzE,KAAK,KAAOE,CACd,CAMA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAMA,UAAU7B,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAEA,OAAO,YAAYC,EAA8C,CAC/D,IAAMC,EAAQD,EAAa,iBAAiB,EAC5C,OAAO,IAAI0B,EAAiBzB,CAAK,CACnC,CAGF,EA7CayB,EAIK,OAAS,GAJpB,IAAMjC,EAANiC","names":["nacl","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","signature","Ed25519Signature","messageBytes","signatureBytes","publicKeyBytes","nacl","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","privateKeyHex","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as s}from"./chunk-3BWYI3KO.mjs";import{a as o}from"./chunk-XGWFFSQ6.mjs";import{b as n}from"./chunk-NL72WE3E.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HWL7DK5X.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/authenticationKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AccountAddress } from \"./accountAddress\";\nimport type { AccountPublicKey } from \"./crypto\";\nimport { Hex } from \"./hex\";\nimport { AuthenticationKeyScheme, HexInput } from \"../types\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\n\n/**\n * Each account stores an authentication key. Authentication key enables account owners to rotate\n * their private key(s) associated with the account without changing the address that hosts their account.\n * @see {@link https://aptos.dev/concepts/accounts | Account Basics}\n *\n * Account addresses can be derived from AuthenticationKey\n */\nexport class AuthenticationKey extends Serializable {\n /**\n * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.\n *\n * The data to hash depends on the underlying public key type and the derivation scheme.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The raw bytes of the authentication key.\n */\n public readonly data: Hex;\n\n constructor(args: { data: HexInput }) {\n super();\n const { data } = args;\n const hex = Hex.fromHexInput(data);\n if (hex.toUint8Array().length !== AuthenticationKey.LENGTH) {\n throw new Error(`Authentication Key length should be ${AuthenticationKey.LENGTH}`);\n }\n this.data = hex;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AuthenticationKey from.\n * @returns An instance of AuthenticationKey.\n */\n static deserialize(deserializer: Deserializer): AuthenticationKey {\n const bytes = deserializer.deserializeFixedBytes(AuthenticationKey.LENGTH);\n return new AuthenticationKey({ data: bytes });\n }\n\n toString(): string {\n return this.data.toString();\n }\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n static fromSchemeAndBytes(args: { scheme: AuthenticationKeyScheme; input: HexInput }): AuthenticationKey {\n const { scheme, input } = args;\n const inputBytes = Hex.fromHexInput(input).toUint8Array();\n const hashInput = new Uint8Array([...inputBytes, scheme]);\n const hash = sha3Hash.create();\n hash.update(hashInput);\n const hashDigest = hash.digest();\n return new AuthenticationKey({ data: hashDigest });\n }\n\n /**\n * @deprecated Use `fromPublicKey` instead\n * Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.\n *\n * This facilitates targeting a specific scheme for deriving an authentication key from a public key.\n *\n * @param args - the public key and scheme to use for the derivation\n */\n public static fromPublicKeyAndScheme(args: { publicKey: AccountPublicKey; scheme: AuthenticationKeyScheme }) {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Converts a PublicKey(s) to an AuthenticationKey, using the derivation scheme inferred from the\n * instance of the PublicKey type passed in.\n *\n * @param args.publicKey\n * @returns AuthenticationKey\n */\n static fromPublicKey(args: { publicKey: AccountPublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes,\n * the AuthenticationKey bytes are directly translated to an AccountAddress.\n *\n * @returns AccountAddress\n */\n derivedAddress(): AccountAddress {\n return new AccountAddress(this.data.toUint8Array());\n }\n}\n"],"mappings":"2HAGA,OAAS,YAAYA,MAAgB,qBAe9B,IAAMC,EAAN,MAAMA,UAA0BC,CAAa,CAalD,YAAYC,EAA0B,CACpC,MAAM,EACN,GAAM,CAAE,KAAAC,CAAK,EAAID,EACXE,EAAMC,EAAI,aAAaF,CAAI,EACjC,GAAIC,EAAI,aAAa,EAAE,SAAWJ,EAAkB,OAClD,MAAM,IAAI,MAAM,uCAAuCA,EAAkB,MAAM,EAAE,EAEnF,KAAK,KAAOI,CACd,CAEA,UAAUE,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,KAAK,aAAa,CAAC,CACzD,CAOA,OAAO,YAAYC,EAA+C,CAChE,IAAMC,EAAQD,EAAa,sBAAsBP,EAAkB,MAAM,EACzE,OAAO,IAAIA,EAAkB,CAAE,KAAMQ,CAAM,CAAC,CAC9C,CAEA,UAAmB,CACjB,OAAO,KAAK,KAAK,SAAS,CAC5B,CAEA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAEA,OAAO,mBAAmBN,EAA+E,CACvG,GAAM,CAAE,OAAAO,EAAQ,MAAAC,CAAM,EAAIR,EACpBS,EAAaN,EAAI,aAAaK,CAAK,EAAE,aAAa,EAClDE,EAAY,IAAI,WAAW,CAAC,GAAGD,EAAYF,CAAM,CAAC,EAClDI,EAAOC,EAAS,OAAO,EAC7BD,EAAK,OAAOD,CAAS,EACrB,IAAMG,EAAaF,EAAK,OAAO,EAC/B,OAAO,IAAIb,EAAkB,CAAE,KAAMe,CAAW,CAAC,CACnD,CAUA,OAAc,uBAAuBb,EAAwE,CAC3G,GAAM,CAAE,UAAAc,CAAU,EAAId,EACtB,OAAOc,EAAU,QAAQ,CAC3B,CASA,OAAO,cAAcd,EAA0D,CAC7E,GAAM,CAAE,UAAAc,CAAU,EAAId,EACtB,OAAOc,EAAU,QAAQ,CAC3B,CAQA,gBAAiC,CAC/B,OAAO,IAAIC,EAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CACF,EAzFajB,EAMK,OAAiB,GAN5B,IAAMkB,EAANlB","names":["sha3Hash","_AuthenticationKey","Serializable","args","data","hex","Hex","serializer","deserializer","bytes","scheme","input","inputBytes","hashInput","hash","sha3Hash","hashDigest","publicKey","AccountAddress","AuthenticationKey"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-XGWFFSQ6.mjs";var r=class a extends i{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HZO2FSG5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,c as d,e as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s,c as d,e as t}from"./chunk-XGWFFSQ6.mjs";import{a as l,b as n,c as o,d as c,e as z,f as u}from"./chunk-56CNRT2K.mjs";var U=class i extends s{constructor(e){super();d(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new i(e.deserializeBool())}},p=class i extends s{constructor(e){super();t(e,0,l),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new i(e.deserializeU8())}},b=class i extends s{constructor(e){super();t(e,0,n),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new i(e.deserializeU16())}},y=class i extends s{constructor(e){super();t(e,0,o),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new i(e.deserializeU32())}},m=class i extends s{constructor(e){super();t(e,BigInt(0),c),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new i(e.deserializeU64())}},B=class i extends s{constructor(e){super();t(e,BigInt(0),z),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new i(e.deserializeU128())}},v=class i extends s{constructor(e){super();t(e,BigInt(0),u),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new i(e.deserializeU256())}};export{U as a,p as b,b as c,y as d,m as e,B as f,v as g};
|
|
2
|
+
//# sourceMappingURL=chunk-IKKFQZDP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as i,c as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r,b as i,c as s}from"./chunk-DGZIRX6Z.mjs";import{a as o}from"./chunk-HE4FXVC4.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),s({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-J2P6ERQF.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as c}from"./chunk-3BWYI3KO.mjs";import{f as e}from"./chunk-ODJTKMBB.mjs";import{d as r}from"./chunk-2CZ7RDU5.mjs";import{d as s}from"./chunk-HEPV52CH.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||20,{data:d}=await r({aptosConfig:t,path:"fund",body:{address:c.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JK2QAXF2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/faucet.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/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\nexport async function fundAccount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n const { aptosConfig, accountAddress, amount, options } = args;\n const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n aptosConfig,\n path: \"fund\",\n body: {\n address: AccountAddress.from(accountAddress).toString(),\n amount,\n },\n originMethod: \"fundAccount\",\n });\n\n const txnHash = data.txn_hashes[0];\n\n const res = await waitForTransaction({\n aptosConfig,\n transactionHash: txnHash,\n options: {\n timeoutSecs: timeout,\n checkSuccess: options?.checkSuccess,\n },\n });\n\n // Response is always User transaction for a user submitted transaction\n if (res.type === TransactionResponseType.User) {\n return res;\n }\n\n throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":"oKAiBA,eAAsBA,EAAYC,EAKG,CACnC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,OAAAC,EAAQ,QAAAC,CAAQ,EAAIJ,EACnDK,EAAUD,GAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/internal/faucet.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/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\nexport async function fundAccount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n const { aptosConfig, accountAddress, amount, options } = args;\n const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n aptosConfig,\n path: \"fund\",\n body: {\n address: AccountAddress.from(accountAddress).toString(),\n amount,\n },\n originMethod: \"fundAccount\",\n });\n\n const txnHash = data.txn_hashes[0];\n\n const res = await waitForTransaction({\n aptosConfig,\n transactionHash: txnHash,\n options: {\n timeoutSecs: timeout,\n checkSuccess: options?.checkSuccess,\n },\n });\n\n // Response is always User transaction for a user submitted transaction\n if (res.type === TransactionResponseType.User) {\n return res;\n }\n\n throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":"oKAiBA,eAAsBA,EAAYC,EAKG,CACnC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,OAAAC,EAAQ,QAAAC,CAAQ,EAAIJ,EACnDK,EAAUD,GAAS,aAAe,GAClC,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAAoD,CACzE,YAAAN,EACA,KAAM,OACN,KAAM,CACJ,QAASO,EAAe,KAAKN,CAAc,EAAE,SAAS,EACtD,OAAAC,CACF,EACA,aAAc,aAChB,CAAC,EAEKM,EAAUH,EAAK,WAAW,CAAC,EAE3BI,EAAM,MAAMC,EAAmB,CACnC,YAAAV,EACA,gBAAiBQ,EACjB,QAAS,CACP,YAAaJ,EACb,aAAcD,GAAS,YACzB,CACF,CAAC,EAGD,GAAIM,EAAI,0BACN,OAAOA,EAGT,MAAM,IAAI,MAAM,qDAAqDA,EAAI,IAAI,EAAE,CACjF","names":["fundAccount","args","aptosConfig","accountAddress","amount","options","timeout","data","postAptosFaucet","AccountAddress","txnHash","res","waitForTransaction"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as s}from"./chunk-FI2B5BQ2.mjs";import{a as n}from"./chunk-HE4FXVC4.mjs";var i=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),o({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),r({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),t({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"events_processor"}),s({aptosConfig:this.config,...e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JOYBEFKL.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-RSV64IPI.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JW65YQSF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-KUX6GQ2E.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as d}from"./chunk-RSV64IPI.mjs";import{d as M}from"./chunk-M4DLGIKP.mjs";import{c as V}from"./chunk-2LRDOYKF.mjs";import{b as w,f as v,i as G,l as A,m as f,n as s,q as p,s as g}from"./chunk-L5WL2GGI.mjs";import{a as I,b as u}from"./chunk-BMDNUQIP.mjs";import{a as T,e as S}from"./chunk-IKKFQZDP.mjs";import{b as c}from"./chunk-3BWYI3KO.mjs";import{d as O}from"./chunk-56CNRT2K.mjs";import{g as b}from"./chunk-QTKWCACE.mjs";import{n as h,w as E,x,y as q}from"./chunk-S4SEFF4K.mjs";var C={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},m="0x4::token::Token";async function _t(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()}};return(await b({aptosConfig:o,query:{query:q,variables:{where_condition:e}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Pt(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()}};return(await b({aptosConfig:o,query:{query:x,variables:{where_condition:e}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function kt(t){let{aptosConfig:o,ownerAddress:n,options:e}=t,r={owner_address:{_eq:c.from(n).toStringLong()},amount:{_gt:0}},i={query:x,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await b({aptosConfig:o,query:i,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Dt(t){let{aptosConfig:o,digitalAssetAddress:n,options:e}=t,r={token_data_id:{_eq:c.from(n).toStringLong()}},i={query:E,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await b({aptosConfig:o,query:i,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Q={typeParameters:[],parameters:[new s(p()),new v,new s(p()),new s(p()),new w,new w,new w,new w,new w,new w,new w,new w,new w,new v,new v]};async function St(t){let{aptosConfig:o,options:n,creator:e}=t;return d({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new u(t.description),new S(t.maxSupply??O),new u(t.name),new u(t.uri),new T(t.mutableDescription??!0),new T(t.mutableRoyalty??!0),new T(t.mutableURI??!0),new T(t.mutableTokenDescription??!0),new T(t.mutableTokenName??!0),new T(t.mutableTokenProperties??!0),new T(t.mutableTokenURI??!0),new T(t.tokensBurnableByCreator??!0),new T(t.tokensFreezableByCreator??!0),new S(t.royaltyNumerator??0),new S(t.royaltyDenominator??1)],abi:Q},options:n})}async function U(t){let{aptosConfig:o,creatorAddress:n,collectionName:e,options:r}=t,i=c.from(n),a={collection_name:{_eq:e},creator_address:{_eq:i.toStringLong()}};return r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard??"v2"}),(await b({aptosConfig:o,query:{query:h,variables:{where_condition:a}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function vt(t){let{aptosConfig:o,collectionId:n}=t,r={collection_id:{_eq:c.from(n).toStringLong()}};return(await b({aptosConfig:o,query:{query:h,variables:{where_condition:r}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ht(t){return(await U(t)).collection_id}var F={typeParameters:[],parameters:[new s(p()),new s(p()),new s(p()),new s(p()),new f(new s(p())),new f(new s(p())),new f(f.u8())]};async function xt(t){let{aptosConfig:o,options:n,creator:e,collection:r,description:i,name:a,uri:l,propertyKeys:y,propertyTypes:P,propertyValues:_}=t,k=P?.map(D=>C[D]);return d({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new u(r),new u(i),new u(a),new u(l),I.MoveString(y??[]),I.MoveString(k??[]),R(_??[],k??[])],abi:F},options:n})}var N={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new G]};async function Gt(t){let{aptosConfig:o,sender:n,digitalAssetAddress:e,recipient:r,digitalAssetType:i,options:a}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[i??m],functionArguments:[c.from(e),c.from(r)],abi:N},options:a})}var Y={typeParameters:[],parameters:[new s(p()),new s(p()),new s(p()),new s(p()),new f(new s(p())),new f(new s(p())),new f(f.u8()),new G]};async function Bt(t){let{aptosConfig:o,account:n,collection:e,description:r,name:i,uri:a,recipient:l,propertyKeys:y,propertyTypes:P,propertyValues:_,options:k}=t;if(y?.length!==_?.length)throw new Error("Property keys and property values counts do not match");if(P?.length!==_?.length)throw new Error("Property types and property values counts do not match");let D=P?.map(K=>C[K]);return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[e,r,i,a,I.MoveString(y??[]),I.MoveString(D??[]),R(_??[],D??[]),l],abi:Y},options:k})}var z={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0)))]};async function Ot(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:i}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[r??m],functionArguments:[c.from(e)],abi:z},options:i})}var L={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0)))]};async function Et(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:i}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[r??m],functionArguments:[e],abi:L},options:i})}var j={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0)))]};async function qt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:i}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[r??m],functionArguments:[e],abi:j},options:i})}var X={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p())]};async function Vt(t){let{aptosConfig:o,creator:n,description:e,digitalAssetAddress:r,digitalAssetType:i,options:a}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[i??m],functionArguments:[c.from(r),new u(e)],abi:X},options:a})}var H={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p())]};async function Mt(t){let{aptosConfig:o,creator:n,name:e,digitalAssetAddress:r,digitalAssetType:i,options:a}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[i??m],functionArguments:[c.from(r),new u(e)],abi:H},options:a})}var J={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p())]};async function Rt(t){let{aptosConfig:o,creator:n,uri:e,digitalAssetAddress:r,digitalAssetType:i,options:a}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[i??m],functionArguments:[c.from(r),new u(e)],abi:J},options:a})}var W={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p()),new s(p()),f.u8()]};async function Kt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:i,digitalAssetAddress:a,digitalAssetType:l,options:y}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[l??m],functionArguments:[c.from(a),new u(e),new u(C[r]),I.U8(B(i,C[r]))],abi:W},options:y})}var Z={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p())]};async function Qt(t){let{aptosConfig:o,creator:n,propertyKey:e,digitalAssetAddress:r,digitalAssetType:i,options:a}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[i??m],functionArguments:[c.from(r),new u(e)],abi:Z},options:a})}var $={typeParameters:[{constraints:["key"]}],parameters:[new s(g(new A(0))),new s(p()),new s(p()),f.u8()]};async function Ut(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:i,digitalAssetAddress:a,digitalAssetType:l,options:y}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[l??m],functionArguments:[c.from(a),new u(e),new u(C[r]),B(i,C[r])],abi:$},options:y})}var tt={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new s(g(new A(0))),new s(p()),new A(1)]};async function Ft(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:i,digitalAssetAddress:a,digitalAssetType:l,options:y}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[l??m,C[r]],functionArguments:[c.from(a),new u(e),i],abi:tt},options:y})}var et={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new s(g(new A(0))),new s(p()),new A(1)]};async function Nt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:i,digitalAssetAddress:a,digitalAssetType:l,options:y}=t;return d({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[l??m,C[r]],functionArguments:[c.from(a),new u(e),i],abi:et},options:y})}function R(t,o){let n=new Array;return o.forEach((e,r)=>{n.push(B(t[r],e))}),n}function B(t,o){let n=V(o);return M(t,n,0,[]).bcsToBytes()}export{_t as a,Pt as b,kt as c,Dt as d,St as e,U as f,vt as g,ht as h,xt as i,Gt as j,Bt as k,Ot as l,Et as m,qt as n,Vt as o,Mt as p,Rt as q,Kt as r,Qt as s,Ut as t,Ft as u,Nt as v};
|
|
2
|
+
//# sourceMappingURL=chunk-L4CAATRY.mjs.map
|