@aptos-labs/ts-sdk 1.15.0 → 1.16.0-zeta.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/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-OUd5ov6z.d.ts} +97 -5
- package/dist/common/chunk-VLEH6QBR.js +2 -0
- package/dist/common/chunk-VLEH6QBR.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +757 -58
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +85 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +225 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +10 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -2
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +13 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- 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 +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +11 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +88 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +32 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +42 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-36QXVFR5.mjs → chunk-272NA6H5.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-272NA6H5.mjs.map} +1 -1
- package/dist/esm/{chunk-R5ST36VJ.mjs → chunk-34WI7I3Z.mjs} +2 -2
- package/dist/esm/chunk-3DP4R3FI.mjs +2 -0
- package/dist/esm/{chunk-FFGY7Z4B.mjs → chunk-3J53BCEQ.mjs} +2 -2
- package/dist/esm/chunk-3SXTTG2X.mjs +2 -0
- package/dist/esm/chunk-3SXTTG2X.mjs.map +1 -0
- package/dist/esm/{chunk-4GWNWSZP.mjs → chunk-3YIUOKWW.mjs} +2 -2
- package/dist/esm/{chunk-EA2DKJPX.mjs → chunk-45ESRYGP.mjs} +2 -2
- package/dist/esm/chunk-4RXGVY2H.mjs +2 -0
- package/dist/esm/chunk-4RXGVY2H.mjs.map +1 -0
- package/dist/esm/chunk-4VAYXBD2.mjs +2 -0
- package/dist/esm/chunk-5SGIYAB7.mjs +2 -0
- package/dist/esm/chunk-5SGIYAB7.mjs.map +1 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs +2 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs.map +1 -0
- package/dist/esm/{chunk-JGSOTNJ5.mjs → chunk-6F3HFDL3.mjs} +2 -2
- package/dist/esm/{chunk-BN22EYXR.mjs → chunk-6MDYCC7P.mjs} +2 -2
- package/dist/esm/{chunk-F7NLNWHN.mjs → chunk-7CJAEAQZ.mjs} +2 -2
- package/dist/esm/chunk-7QGIAVW4.mjs +2 -0
- package/dist/esm/chunk-7QGIAVW4.mjs.map +1 -0
- package/dist/esm/chunk-7UBKXR37.mjs +2 -0
- package/dist/esm/chunk-7UBKXR37.mjs.map +1 -0
- package/dist/esm/{chunk-JQIGQMNZ.mjs → chunk-7Y6AWDBZ.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/chunk-AUAL3H36.mjs +2 -0
- package/dist/esm/{chunk-I5T6PHDV.mjs → chunk-AUV4VAXK.mjs} +2 -2
- package/dist/esm/{chunk-2X7A4HUS.mjs → chunk-AVWAYKNS.mjs} +2 -2
- package/dist/esm/{chunk-EZPUVLME.mjs → chunk-BNA3SGG6.mjs} +2 -2
- package/dist/esm/chunk-CEGCSC3T.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs.map +1 -0
- package/dist/esm/{chunk-F4GDEXZ6.mjs → chunk-CZOUSIAD.mjs} +2 -2
- package/dist/esm/chunk-D76FE35G.mjs +2 -0
- package/dist/esm/chunk-D76FE35G.mjs.map +1 -0
- package/dist/esm/{chunk-A4JUQZXI.mjs → chunk-DSVNXD5A.mjs} +2 -2
- package/dist/esm/chunk-EJ7ODMDA.mjs +2 -0
- package/dist/esm/{chunk-UR3JTLIT.mjs → chunk-EJURLI4L.mjs} +2 -2
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs.map +1 -0
- package/dist/esm/chunk-FWTJQHJR.mjs +2 -0
- package/dist/esm/chunk-FWTJQHJR.mjs.map +1 -0
- package/dist/esm/{chunk-AHW3SKT7.mjs → chunk-GHHIUWPP.mjs} +2 -2
- package/dist/esm/{chunk-G56GPLTB.mjs → chunk-GS5Z3HO7.mjs} +2 -2
- package/dist/esm/chunk-HGRU3HWY.mjs +2 -0
- package/dist/esm/{chunk-P5TZBE3L.mjs.map → chunk-HGRU3HWY.mjs.map} +1 -1
- package/dist/esm/{chunk-XFSDV3ND.mjs → chunk-HOX6Q6ZP.mjs} +2 -2
- package/dist/esm/chunk-HQK6MF3G.mjs +2 -0
- package/dist/esm/chunk-IMVC2JKU.mjs +2 -0
- package/dist/esm/{chunk-2XK53QFA.mjs.map → chunk-IMVC2JKU.mjs.map} +1 -1
- package/dist/esm/chunk-ISXBJPLD.mjs +2 -0
- package/dist/esm/{chunk-JX75UKJX.mjs → chunk-IU6REVKX.mjs} +2 -2
- package/dist/esm/{chunk-ERIPXWXJ.mjs → chunk-IWKIZLFW.mjs} +2 -2
- package/dist/esm/{chunk-PIVZMT5D.mjs → chunk-J534ICWA.mjs} +2 -2
- package/dist/esm/chunk-J577ODDM.mjs +2 -0
- package/dist/esm/chunk-JBTLE33X.mjs +2 -0
- package/dist/esm/{chunk-CJDEPZ4J.mjs.map → chunk-JBTLE33X.mjs.map} +1 -1
- package/dist/esm/chunk-JCDZ2WXX.mjs +2 -0
- package/dist/esm/chunk-JCDZ2WXX.mjs.map +1 -0
- package/dist/esm/{chunk-YK63A5T6.mjs → chunk-LLRWILVZ.mjs} +2 -2
- package/dist/esm/chunk-M4Q4XDVR.mjs +2 -0
- package/dist/esm/chunk-M4Q4XDVR.mjs.map +1 -0
- package/dist/esm/chunk-MEOBWD6V.mjs +2 -0
- package/dist/esm/chunk-MEOBWD6V.mjs.map +1 -0
- package/dist/esm/{chunk-35EWRSDK.mjs → chunk-MLQT5I6K.mjs} +2 -2
- package/dist/esm/chunk-MSGHGK52.mjs +2 -0
- package/dist/esm/{chunk-5EN52MUT.mjs → chunk-NGTNMV6Q.mjs} +2 -2
- package/dist/esm/{chunk-P46OPJB4.mjs → chunk-NH466YFP.mjs} +2 -2
- package/dist/esm/chunk-NMD45OTM.mjs +2 -0
- package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
- package/dist/esm/{chunk-ZM33M6QO.mjs → chunk-NUBYALZP.mjs} +2 -2
- package/dist/esm/{chunk-CHWE77CR.mjs → chunk-OFC75EWS.mjs} +2 -2
- package/dist/esm/{chunk-H6FEXRTK.mjs → chunk-OOYRJQPD.mjs} +2 -2
- package/dist/esm/chunk-OZ3GSAFK.mjs +2 -0
- package/dist/esm/chunk-OZ3GSAFK.mjs.map +1 -0
- package/dist/esm/chunk-PENBUSGL.mjs +2 -0
- package/dist/esm/chunk-PENBUSGL.mjs.map +1 -0
- package/dist/esm/{chunk-WN3JL7ZT.mjs → chunk-PG7KSUMN.mjs} +2 -2
- package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-PGP2XMDE.mjs} +2 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-CYTRYBWN.mjs → chunk-QJIMZI32.mjs} +2 -2
- package/dist/esm/{chunk-E56MTU2U.mjs → chunk-QLE5JL4X.mjs} +2 -2
- package/dist/esm/{chunk-WNPL4SEJ.mjs → chunk-QOOHLRRJ.mjs} +2 -2
- package/dist/esm/chunk-QYEJOEWB.mjs +2 -0
- package/dist/esm/chunk-QYEJOEWB.mjs.map +1 -0
- package/dist/esm/{chunk-TM7NDDT3.mjs → chunk-R4HLV32L.mjs} +2 -2
- package/dist/esm/chunk-RAHMGSBW.mjs +2 -0
- package/dist/esm/chunk-RAHMGSBW.mjs.map +1 -0
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-RKHPXZM6.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-RKHPXZM6.mjs.map} +1 -1
- package/dist/esm/{chunk-MCRRHBFQ.mjs → chunk-RWYPGTNL.mjs} +2 -2
- package/dist/esm/chunk-SCHMTP4N.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-GP6Z47HM.mjs → chunk-SCRIQQV3.mjs} +2 -2
- package/dist/esm/{chunk-NGQR5UQ3.mjs → chunk-SNBE5YAC.mjs} +2 -2
- package/dist/esm/chunk-SSDWEOF7.mjs +2 -0
- package/dist/esm/chunk-SSDWEOF7.mjs.map +1 -0
- package/dist/esm/chunk-SZ6KR73C.mjs +2 -0
- package/dist/esm/chunk-SZ6KR73C.mjs.map +1 -0
- package/dist/esm/{chunk-UW2FPXYA.mjs → chunk-THURV6CN.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-GUALXVFI.mjs → chunk-TU6VKYDC.mjs} +2 -2
- package/dist/esm/{chunk-DZSDCUP2.mjs → chunk-UFMIMN7W.mjs} +2 -2
- package/dist/esm/{chunk-3Y46WJUR.mjs → chunk-ULW5LX5H.mjs} +2 -2
- package/dist/esm/chunk-V6M7FGQT.mjs +2 -0
- package/dist/esm/chunk-V6M7FGQT.mjs.map +1 -0
- package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-VBODXPT3.mjs} +2 -2
- package/dist/esm/chunk-VMVSUH2K.mjs +2 -0
- package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-WHSN42R2.mjs} +2 -2
- package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-WHSN42R2.mjs.map} +1 -1
- package/dist/esm/{chunk-ZCG6WBLE.mjs → chunk-WJIICWOB.mjs} +2 -2
- package/dist/esm/{chunk-T2AGN5YT.mjs → chunk-WOLLRMXR.mjs} +2 -2
- package/dist/esm/chunk-WSVJNBSJ.mjs +2 -0
- package/dist/esm/{chunk-YMB2XW2O.mjs.map → chunk-WSVJNBSJ.mjs.map} +1 -1
- package/dist/esm/chunk-WXLSJF4A.mjs +2 -0
- package/dist/esm/chunk-WXLSJF4A.mjs.map +1 -0
- package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-XQ7I34AL.mjs} +2 -2
- package/dist/esm/{chunk-RT6LEYHZ.mjs → chunk-Y24BMR2W.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-HSJTQLI2.mjs → chunk-YLQJBXUF.mjs} +2 -2
- package/dist/esm/chunk-ZAXWW7VW.mjs +2 -0
- package/dist/esm/chunk-ZAXWW7VW.mjs.map +1 -0
- package/dist/esm/chunk-ZV5P2GSJ.mjs +2 -0
- package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-ZV5P2GSJ.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +8 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +9 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +5 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +5 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +276 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +19 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/proof.d.mts +21 -0
- package/dist/esm/core/crypto/proof.mjs +2 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +5 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +16 -8
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +78 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +3 -3
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -3
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -13
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +23 -5
- package/dist/esm/types/index.d.mts +21 -5
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +52 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +4 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +11 -3
- package/src/account/EphemeralKeyPair.ts +157 -0
- package/src/account/KeylessAccount.ts +404 -0
- package/src/account/MultiKeyAccount.ts +11 -0
- package/src/account/index.ts +2 -0
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/keyless.ts +59 -0
- package/src/bcs/deserializer.ts +46 -0
- package/src/bcs/serializer.ts +58 -0
- package/src/cli/localNode.ts +11 -1
- package/src/cli/move.ts +11 -1
- package/src/client/core.ts +5 -0
- package/src/client/get.ts +12 -0
- package/src/client/post.ts +18 -0
- package/src/client/types.ts +1 -1
- package/src/core/crypto/cryptoHasher.ts +16 -0
- package/src/core/crypto/ephemeral.ts +138 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +589 -0
- package/src/core/crypto/poseidon.ts +142 -0
- package/src/core/crypto/proof.ts +16 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/keyless.ts +175 -0
- package/src/internal/transactionSubmission.ts +7 -2
- package/src/transactions/transactionBuilder/remoteAbi.ts +16 -2
- package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
- package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
- package/src/transactions/typeTag/parser.ts +98 -52
- package/src/transactions/types.ts +22 -3
- package/src/types/index.ts +24 -2
- package/src/types/keyless.ts +42 -0
- package/src/utils/apiEndpoints.ts +16 -0
- package/src/utils/const.ts +2 -0
- package/src/utils/helpers.ts +25 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-KSEUZTKY.js +0 -2
- package/dist/common/chunk-KSEUZTKY.js.map +0 -1
- package/dist/esm/chunk-2XK53QFA.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
- package/dist/esm/chunk-53INTTOI.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-AF5WNJOP.mjs +0 -2
- package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
- package/dist/esm/chunk-BBKE2QJU.mjs +0 -2
- package/dist/esm/chunk-BBKE2QJU.mjs.map +0 -1
- package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
- package/dist/esm/chunk-CJDEPZ4J.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-GPEM3JVU.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
- package/dist/esm/chunk-IENCDVPF.mjs +0 -2
- package/dist/esm/chunk-IENCDVPF.mjs.map +0 -1
- package/dist/esm/chunk-L54P6EGN.mjs +0 -2
- package/dist/esm/chunk-L54P6EGN.mjs.map +0 -1
- package/dist/esm/chunk-LDQ6JFEF.mjs +0 -2
- package/dist/esm/chunk-LDQ6JFEF.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-LQNPI3IR.mjs +0 -2
- package/dist/esm/chunk-LQNPI3IR.mjs.map +0 -1
- package/dist/esm/chunk-MJPUASSD.mjs +0 -2
- package/dist/esm/chunk-MJPUASSD.mjs.map +0 -1
- package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
- package/dist/esm/chunk-O2K7RZWM.mjs +0 -2
- package/dist/esm/chunk-O2K7RZWM.mjs.map +0 -1
- package/dist/esm/chunk-O4WVPLUX.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-P5TZBE3L.mjs +0 -2
- package/dist/esm/chunk-PF57EOJY.mjs +0 -2
- package/dist/esm/chunk-PZ4SAXY7.mjs +0 -2
- package/dist/esm/chunk-PZ4SAXY7.mjs.map +0 -1
- package/dist/esm/chunk-RFZ5LTGP.mjs +0 -2
- package/dist/esm/chunk-RFZ5LTGP.mjs.map +0 -1
- package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
- package/dist/esm/chunk-S2VSJJRJ.mjs +0 -2
- package/dist/esm/chunk-S2VSJJRJ.mjs.map +0 -1
- package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
- package/dist/esm/chunk-UGPALAPN.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-YCC6HN74.mjs +0 -2
- package/dist/esm/chunk-YCC6HN74.mjs.map +0 -1
- package/dist/esm/chunk-YMB2XW2O.mjs +0 -2
- /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-R5ST36VJ.mjs.map → chunk-34WI7I3Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-53INTTOI.mjs.map → chunk-3DP4R3FI.mjs.map} +0 -0
- /package/dist/esm/{chunk-FFGY7Z4B.mjs.map → chunk-3J53BCEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-4GWNWSZP.mjs.map → chunk-3YIUOKWW.mjs.map} +0 -0
- /package/dist/esm/{chunk-EA2DKJPX.mjs.map → chunk-45ESRYGP.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-4VAYXBD2.mjs.map} +0 -0
- /package/dist/esm/{chunk-JGSOTNJ5.mjs.map → chunk-6F3HFDL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-BN22EYXR.mjs.map → chunk-6MDYCC7P.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7NLNWHN.mjs.map → chunk-7CJAEAQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-JQIGQMNZ.mjs.map → chunk-7Y6AWDBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-AUAL3H36.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5T6PHDV.mjs.map → chunk-AUV4VAXK.mjs.map} +0 -0
- /package/dist/esm/{chunk-2X7A4HUS.mjs.map → chunk-AVWAYKNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EZPUVLME.mjs.map → chunk-BNA3SGG6.mjs.map} +0 -0
- /package/dist/esm/{chunk-GPEM3JVU.mjs.map → chunk-CEGCSC3T.mjs.map} +0 -0
- /package/dist/esm/{chunk-F4GDEXZ6.mjs.map → chunk-CZOUSIAD.mjs.map} +0 -0
- /package/dist/esm/{chunk-A4JUQZXI.mjs.map → chunk-DSVNXD5A.mjs.map} +0 -0
- /package/dist/esm/{chunk-AF5WNJOP.mjs.map → chunk-EJ7ODMDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UR3JTLIT.mjs.map → chunk-EJURLI4L.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-AHW3SKT7.mjs.map → chunk-GHHIUWPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-GS5Z3HO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-XFSDV3ND.mjs.map → chunk-HOX6Q6ZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-HQK6MF3G.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4WVPLUX.mjs.map → chunk-ISXBJPLD.mjs.map} +0 -0
- /package/dist/esm/{chunk-JX75UKJX.mjs.map → chunk-IU6REVKX.mjs.map} +0 -0
- /package/dist/esm/{chunk-ERIPXWXJ.mjs.map → chunk-IWKIZLFW.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIVZMT5D.mjs.map → chunk-J534ICWA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-J577ODDM.mjs.map} +0 -0
- /package/dist/esm/{chunk-YK63A5T6.mjs.map → chunk-LLRWILVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-MLQT5I6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-MSGHGK52.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-NGTNMV6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-P46OPJB4.mjs.map → chunk-NH466YFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZM33M6QO.mjs.map → chunk-NUBYALZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-CHWE77CR.mjs.map → chunk-OFC75EWS.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6FEXRTK.mjs.map → chunk-OOYRJQPD.mjs.map} +0 -0
- /package/dist/esm/{chunk-WN3JL7ZT.mjs.map → chunk-PG7KSUMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-PGP2XMDE.mjs.map} +0 -0
- /package/dist/esm/{chunk-CYTRYBWN.mjs.map → chunk-QJIMZI32.mjs.map} +0 -0
- /package/dist/esm/{chunk-E56MTU2U.mjs.map → chunk-QLE5JL4X.mjs.map} +0 -0
- /package/dist/esm/{chunk-WNPL4SEJ.mjs.map → chunk-QOOHLRRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-TM7NDDT3.mjs.map → chunk-R4HLV32L.mjs.map} +0 -0
- /package/dist/esm/{chunk-MCRRHBFQ.mjs.map → chunk-RWYPGTNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-SCHMTP4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-GP6Z47HM.mjs.map → chunk-SCRIQQV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-NGQR5UQ3.mjs.map → chunk-SNBE5YAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UW2FPXYA.mjs.map → chunk-THURV6CN.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-GUALXVFI.mjs.map → chunk-TU6VKYDC.mjs.map} +0 -0
- /package/dist/esm/{chunk-DZSDCUP2.mjs.map → chunk-UFMIMN7W.mjs.map} +0 -0
- /package/dist/esm/{chunk-3Y46WJUR.mjs.map → chunk-ULW5LX5H.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-VBODXPT3.mjs.map} +0 -0
- /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-VMVSUH2K.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZCG6WBLE.mjs.map → chunk-WJIICWOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2AGN5YT.mjs.map → chunk-WOLLRMXR.mjs.map} +0 -0
- /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-XQ7I34AL.mjs.map} +0 -0
- /package/dist/esm/{chunk-RT6LEYHZ.mjs.map → chunk-Y24BMR2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-HSJTQLI2.mjs.map → chunk-YLQJBXUF.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
|
@@ -21,18 +21,64 @@ import {
|
|
|
21
21
|
import { AccountAddress } from "../../core";
|
|
22
22
|
import { Identifier } from "../instances/identifier";
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Tells if the string is a valid Move identifier. It can only be alphanumeric and `_`
|
|
26
|
+
* @param str
|
|
27
|
+
*/
|
|
24
28
|
function isValidIdentifier(str: string) {
|
|
25
29
|
return !!str.match(/^[_a-zA-Z0-9]+$/);
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Tells if the character is a whitespace character. Does not work for multiple characters
|
|
34
|
+
* @param char
|
|
35
|
+
*/
|
|
28
36
|
function isValidWhitespaceCharacter(char: string) {
|
|
29
37
|
return !!char.match(/\s/);
|
|
30
38
|
}
|
|
31
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Tells if a type is a generic type from the ABI, this will be of the form T0, T1, ...
|
|
42
|
+
* @param str
|
|
43
|
+
*/
|
|
32
44
|
function isGeneric(str: string) {
|
|
33
45
|
return !!str.match(/^T[0-9]+$/);
|
|
34
46
|
}
|
|
35
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Tells if a type is a reference type (starts with &)
|
|
50
|
+
* @param str
|
|
51
|
+
*/
|
|
52
|
+
function isRef(str: string) {
|
|
53
|
+
return !!str.match(/^&.+$/);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Tells if a type is a primitive type
|
|
58
|
+
* @param str
|
|
59
|
+
*/
|
|
60
|
+
function isPrimitive(str: string) {
|
|
61
|
+
switch (str) {
|
|
62
|
+
case "signer":
|
|
63
|
+
case "address":
|
|
64
|
+
case "bool":
|
|
65
|
+
case "u8":
|
|
66
|
+
case "u16":
|
|
67
|
+
case "u32":
|
|
68
|
+
case "u64":
|
|
69
|
+
case "u128":
|
|
70
|
+
case "u256":
|
|
71
|
+
return true;
|
|
72
|
+
default:
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Consumes all whitespace in a string, similar to trim
|
|
79
|
+
* @param tagStr
|
|
80
|
+
* @param pos
|
|
81
|
+
*/
|
|
36
82
|
function consumeWhitespace(tagStr: string, pos: number) {
|
|
37
83
|
let i = pos;
|
|
38
84
|
for (; i < tagStr.length; i += 1) {
|
|
@@ -46,6 +92,9 @@ function consumeWhitespace(tagStr: string, pos: number) {
|
|
|
46
92
|
return i;
|
|
47
93
|
}
|
|
48
94
|
|
|
95
|
+
/**
|
|
96
|
+
* State for TypeTag parsing. This is pushed onto a stack to keep track of what is the current state
|
|
97
|
+
*/
|
|
49
98
|
type TypeTagState = {
|
|
50
99
|
savedExpectedTypes: number;
|
|
51
100
|
savedStr: string;
|
|
@@ -60,11 +109,13 @@ export enum TypeTagParserErrorType {
|
|
|
60
109
|
UnexpectedComma = "unexpected ','",
|
|
61
110
|
TypeArgumentCountMismatch = "type argument count doesn't match expected amount",
|
|
62
111
|
MissingTypeArgumentClose = "no matching '>' for '<'",
|
|
112
|
+
MissingTypeArgument = "no type argument before ','",
|
|
63
113
|
UnexpectedPrimitiveTypeArguments = "primitive types not expected to have type arguments",
|
|
64
114
|
UnexpectedVectorTypeArgumentCount = "vector type expected to have exactly one type argument",
|
|
65
115
|
UnexpectedStructFormat = "unexpected struct format, must be of the form 0xaddress::module_name::struct_name",
|
|
66
116
|
InvalidModuleNameCharacter = "module name must only contain alphanumeric or '_' characters",
|
|
67
117
|
InvalidStructNameCharacter = "struct name must only contain alphanumeric or '_' characters",
|
|
118
|
+
InvalidAddress = "struct address must be valid",
|
|
68
119
|
}
|
|
69
120
|
|
|
70
121
|
export class TypeTagParserError extends Error {
|
|
@@ -141,16 +192,24 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
|
|
|
141
192
|
expectedTypes = savedExpectedTypes;
|
|
142
193
|
} else if (char === ",") {
|
|
143
194
|
// Comma means we need to start parsing a new tag, push the previous one to the curTypes
|
|
144
|
-
// Process last type, if there is no type string, then don't parse it
|
|
145
|
-
if (currentStr.length !== 0) {
|
|
146
|
-
const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
|
|
147
195
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
196
|
+
// No top level commas (not in a type <> are allowed)
|
|
197
|
+
if (saved.length === 0) {
|
|
198
|
+
throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);
|
|
199
|
+
}
|
|
200
|
+
// If there was no actual value before the comma, then it's missing a type argument
|
|
201
|
+
if (currentStr.length === 0) {
|
|
202
|
+
throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgument);
|
|
153
203
|
}
|
|
204
|
+
|
|
205
|
+
// Process characters before as a type
|
|
206
|
+
const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
|
|
207
|
+
|
|
208
|
+
// parse type tag and push it on the types
|
|
209
|
+
innerTypes = [];
|
|
210
|
+
curTypes.push(newType);
|
|
211
|
+
currentStr = "";
|
|
212
|
+
expectedTypes += 1;
|
|
154
213
|
} else if (isValidWhitespaceCharacter(char)) {
|
|
155
214
|
// This means we should save what we have and everything else should skip until the next
|
|
156
215
|
let parsedTypeTag = false;
|
|
@@ -207,59 +266,35 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
|
|
|
207
266
|
* Parses a type tag with internal types associated
|
|
208
267
|
* @param str
|
|
209
268
|
* @param types
|
|
269
|
+
* @param allowGenerics allow generic in parsing of the type tag
|
|
210
270
|
*/
|
|
211
271
|
function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: boolean): TypeTag {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
272
|
+
const trimmedStr = str.trim();
|
|
273
|
+
const lowerCaseTrimmed = trimmedStr.toLowerCase();
|
|
274
|
+
if (isPrimitive(lowerCaseTrimmed)) {
|
|
275
|
+
if (types.length > 0) {
|
|
276
|
+
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
switch (trimmedStr.toLowerCase()) {
|
|
219
281
|
case "signer":
|
|
220
|
-
if (types.length > 0) {
|
|
221
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
222
|
-
}
|
|
223
282
|
return new TypeTagSigner();
|
|
224
283
|
case "bool":
|
|
225
|
-
if (types.length > 0) {
|
|
226
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
227
|
-
}
|
|
228
284
|
return new TypeTagBool();
|
|
229
285
|
case "address":
|
|
230
|
-
if (types.length > 0) {
|
|
231
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
232
|
-
}
|
|
233
286
|
return new TypeTagAddress();
|
|
234
287
|
case "u8":
|
|
235
|
-
if (types.length > 0) {
|
|
236
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
237
|
-
}
|
|
238
288
|
return new TypeTagU8();
|
|
239
289
|
case "u16":
|
|
240
|
-
if (types.length > 0) {
|
|
241
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
242
|
-
}
|
|
243
290
|
return new TypeTagU16();
|
|
244
291
|
case "u32":
|
|
245
|
-
if (types.length > 0) {
|
|
246
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
247
|
-
}
|
|
248
292
|
return new TypeTagU32();
|
|
249
293
|
case "u64":
|
|
250
|
-
if (types.length > 0) {
|
|
251
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
252
|
-
}
|
|
253
294
|
return new TypeTagU64();
|
|
254
295
|
case "u128":
|
|
255
|
-
if (types.length > 0) {
|
|
256
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
257
|
-
}
|
|
258
296
|
return new TypeTagU128();
|
|
259
297
|
case "u256":
|
|
260
|
-
if (types.length > 0) {
|
|
261
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
262
|
-
}
|
|
263
298
|
return new TypeTagU256();
|
|
264
299
|
case "vector":
|
|
265
300
|
if (types.length !== 1) {
|
|
@@ -267,25 +302,41 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
267
302
|
}
|
|
268
303
|
return new TypeTagVector(types[0]);
|
|
269
304
|
default:
|
|
270
|
-
|
|
305
|
+
// Reference will have to handle the inner type
|
|
306
|
+
if (isRef(trimmedStr)) {
|
|
307
|
+
const actualType = trimmedStr.substring(1);
|
|
308
|
+
return new TypeTagReference(parseTypeTagInner(actualType, types, allowGenerics));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Generics are always expected to be T0 or T1
|
|
312
|
+
if (isGeneric(trimmedStr)) {
|
|
271
313
|
if (allowGenerics) {
|
|
272
|
-
return new TypeTagGeneric(Number(
|
|
314
|
+
return new TypeTagGeneric(Number(trimmedStr.split("T")[1]));
|
|
273
315
|
}
|
|
274
316
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedGenericType);
|
|
275
317
|
}
|
|
276
318
|
|
|
277
319
|
// If the value doesn't contain a colon, then we'll assume it isn't trying to be a struct
|
|
278
|
-
if (!
|
|
320
|
+
if (!trimmedStr.match(/:/)) {
|
|
279
321
|
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidTypeTag);
|
|
280
322
|
}
|
|
281
323
|
|
|
282
324
|
// Parse for a struct tag
|
|
283
325
|
// eslint-disable-next-line no-case-declarations
|
|
284
|
-
const structParts =
|
|
326
|
+
const structParts = trimmedStr.split("::");
|
|
285
327
|
if (structParts.length !== 3) {
|
|
286
328
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);
|
|
287
329
|
}
|
|
288
330
|
|
|
331
|
+
// Validate struct address
|
|
332
|
+
// eslint-disable-next-line no-case-declarations
|
|
333
|
+
let address: AccountAddress;
|
|
334
|
+
try {
|
|
335
|
+
address = AccountAddress.fromString(structParts[0]);
|
|
336
|
+
} catch (error: any) {
|
|
337
|
+
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);
|
|
338
|
+
}
|
|
339
|
+
|
|
289
340
|
// Validate identifier characters
|
|
290
341
|
if (!isValidIdentifier(structParts[1])) {
|
|
291
342
|
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidModuleNameCharacter);
|
|
@@ -295,12 +346,7 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
295
346
|
}
|
|
296
347
|
|
|
297
348
|
return new TypeTagStruct(
|
|
298
|
-
new StructTag(
|
|
299
|
-
AccountAddress.fromString(structParts[0]),
|
|
300
|
-
new Identifier(structParts[1]),
|
|
301
|
-
new Identifier(structParts[2]),
|
|
302
|
-
types,
|
|
303
|
-
),
|
|
349
|
+
new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),
|
|
304
350
|
);
|
|
305
351
|
}
|
|
306
352
|
}
|
|
@@ -68,6 +68,25 @@ export type ScriptFunctionArgumentTypes =
|
|
|
68
68
|
| MoveString
|
|
69
69
|
| FixedBytes;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* TypeArgument inputs for Entry functions, view functions, and scripts
|
|
73
|
+
*
|
|
74
|
+
* This can be a string version of the type argument such as:
|
|
75
|
+
* - u8
|
|
76
|
+
* - u16
|
|
77
|
+
* - u32
|
|
78
|
+
* - u64
|
|
79
|
+
* - u128
|
|
80
|
+
* - u256
|
|
81
|
+
* - bool
|
|
82
|
+
* - address
|
|
83
|
+
* - signer
|
|
84
|
+
* - vector<Type>
|
|
85
|
+
* - address::module::struct
|
|
86
|
+
* - address::module::struct<Type1, Type2>
|
|
87
|
+
*/
|
|
88
|
+
export type TypeArgument = TypeTag | string;
|
|
89
|
+
|
|
71
90
|
/**
|
|
72
91
|
* Type that holds all raw transaction instances Aptos SDK supports
|
|
73
92
|
*/
|
|
@@ -109,7 +128,7 @@ export type InputGenerateTransactionPayloadDataWithRemoteABI =
|
|
|
109
128
|
*/
|
|
110
129
|
export type InputEntryFunctionData = {
|
|
111
130
|
function: MoveFunctionId;
|
|
112
|
-
typeArguments?: Array<
|
|
131
|
+
typeArguments?: Array<TypeArgument>;
|
|
113
132
|
functionArguments: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
|
|
114
133
|
abi?: EntryFunctionABI;
|
|
115
134
|
};
|
|
@@ -144,7 +163,7 @@ export type InputMultiSigDataWithRemoteABI = {
|
|
|
144
163
|
*/
|
|
145
164
|
export type InputScriptData = {
|
|
146
165
|
bytecode: HexInput;
|
|
147
|
-
typeArguments?: Array<
|
|
166
|
+
typeArguments?: Array<TypeArgument>;
|
|
148
167
|
functionArguments: Array<ScriptFunctionArgumentTypes>;
|
|
149
168
|
};
|
|
150
169
|
|
|
@@ -153,7 +172,7 @@ export type InputScriptData = {
|
|
|
153
172
|
*/
|
|
154
173
|
export type InputViewFunctionData = {
|
|
155
174
|
function: MoveFunctionId;
|
|
156
|
-
typeArguments?: Array<
|
|
175
|
+
typeArguments?: Array<TypeArgument>;
|
|
157
176
|
functionArguments?: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
|
|
158
177
|
abi?: ViewFunctionABI;
|
|
159
178
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -108,11 +108,29 @@ export enum AccountAuthenticatorVariant {
|
|
|
108
108
|
export enum AnyPublicKeyVariant {
|
|
109
109
|
Ed25519 = 0,
|
|
110
110
|
Secp256k1 = 1,
|
|
111
|
+
Keyless = 3,
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export enum AnySignatureVariant {
|
|
114
115
|
Ed25519 = 0,
|
|
115
116
|
Secp256k1 = 1,
|
|
117
|
+
Keyless = 3,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export enum EphemeralPublicKeyVariant {
|
|
121
|
+
Ed25519 = 0,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export enum EphemeralSignatureVariant {
|
|
125
|
+
Ed25519 = 0,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export enum EphemeralCertificateVariant {
|
|
129
|
+
ZkProof = 0,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export enum ZkpVariant {
|
|
133
|
+
Groth16 = 0,
|
|
116
134
|
}
|
|
117
135
|
|
|
118
136
|
/**
|
|
@@ -140,6 +158,10 @@ export type AptosSettings = {
|
|
|
140
158
|
|
|
141
159
|
readonly indexer?: string;
|
|
142
160
|
|
|
161
|
+
readonly pepper?: string;
|
|
162
|
+
|
|
163
|
+
readonly prover?: string;
|
|
164
|
+
|
|
143
165
|
readonly clientConfig?: ClientConfig;
|
|
144
166
|
|
|
145
167
|
readonly client?: Client;
|
|
@@ -300,9 +322,9 @@ export type GasEstimation = {
|
|
|
300
322
|
prioritized_gas_estimate?: number;
|
|
301
323
|
};
|
|
302
324
|
|
|
303
|
-
export type MoveResource = {
|
|
325
|
+
export type MoveResource<T = {}> = {
|
|
304
326
|
type: MoveStructId;
|
|
305
|
-
data:
|
|
327
|
+
data: T;
|
|
306
328
|
};
|
|
307
329
|
|
|
308
330
|
export type AccountData = {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type ProverRequest = {
|
|
2
|
+
jwt_b64: string,
|
|
3
|
+
epk: string,
|
|
4
|
+
exp_date_secs: number,
|
|
5
|
+
exp_horizon_secs: number,
|
|
6
|
+
epk_blinder: string,
|
|
7
|
+
uid_key: string,
|
|
8
|
+
pepper: string,
|
|
9
|
+
};
|
|
10
|
+
export type ProverResponse = {
|
|
11
|
+
proof: { a: string; b: string; c: string };
|
|
12
|
+
public_inputs_hash: string;
|
|
13
|
+
training_wheels_signature: string;
|
|
14
|
+
};
|
|
15
|
+
export type PepperFetchRequest = {
|
|
16
|
+
jwt_b64: number,
|
|
17
|
+
epk: string,
|
|
18
|
+
exp_date_secs: number,
|
|
19
|
+
epk_blinder: string,
|
|
20
|
+
uid_key: string,
|
|
21
|
+
derivation_path: string,
|
|
22
|
+
};
|
|
23
|
+
export type PepperFetchResponse = { signature: string; pepper: string; address: string };
|
|
24
|
+
|
|
25
|
+
export type KeylessConfigurationResponse = {
|
|
26
|
+
max_commited_epk_bytes: number,
|
|
27
|
+
max_exp_horizon_secs: string,
|
|
28
|
+
max_extra_field_bytes: number,
|
|
29
|
+
max_iss_val_bytes: number,
|
|
30
|
+
max_jwt_header_b64_bytes: number,
|
|
31
|
+
max_signatures_per_txn: number,
|
|
32
|
+
override_aud_vals: string[],
|
|
33
|
+
training_wheels_pubkey: { vec: string[] }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type Groth16VerificationKeyResponse = {
|
|
37
|
+
alpha_g1: string;
|
|
38
|
+
beta_g2: string;
|
|
39
|
+
delta_g2: string;
|
|
40
|
+
gamma_abc_g1: [string, string];
|
|
41
|
+
gamma_g2: string;
|
|
42
|
+
};
|
|
@@ -22,6 +22,22 @@ export const NetworkToFaucetAPI: Record<string, string> = {
|
|
|
22
22
|
local: "http://127.0.0.1:8081",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
export const NetworkToPepperAPI: Record<string, string> = {
|
|
26
|
+
mainnet: "https://api.mainnet.aptoslabs.com/keyless/pepper/v0",
|
|
27
|
+
testnet: "https://api.testnet.aptoslabs.com/keyless/pepper/v0",
|
|
28
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
|
|
29
|
+
// Use the devnet service for local environment
|
|
30
|
+
local: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const NetworkToProverAPI: Record<string, string> = {
|
|
34
|
+
mainnet: "https://api.mainnet.aptoslabs.com/keyless/prover/v0",
|
|
35
|
+
testnet: "https://api.testnet.aptoslabs.com/keyless/prover/v0",
|
|
36
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
|
|
37
|
+
// Use the devnet service for local environment
|
|
38
|
+
local: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
|
|
39
|
+
};
|
|
40
|
+
|
|
25
41
|
export enum Network {
|
|
26
42
|
MAINNET = "mainnet",
|
|
27
43
|
TESTNET = "testnet",
|
package/src/utils/const.ts
CHANGED
package/src/utils/helpers.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { decode } from "js-base64";
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Sleep the current thread for the given amount of time
|
|
6
8
|
* @param timeMs time in milliseconds to sleep
|
|
@@ -10,3 +12,26 @@ export async function sleep(timeMs: number): Promise<null> {
|
|
|
10
12
|
setTimeout(resolve, timeMs);
|
|
11
13
|
});
|
|
12
14
|
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export function currentTimeInSeconds(): number {
|
|
18
|
+
return Math.floor(new Date().getTime() / 1000);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function floorToWholeHour(timestampInSeconds: number): number {
|
|
22
|
+
const date = new Date(timestampInSeconds * 1000);
|
|
23
|
+
// Reset minutes and seconds to zero
|
|
24
|
+
date.setMinutes(0);
|
|
25
|
+
date.setSeconds(0);
|
|
26
|
+
date.setMilliseconds(0);
|
|
27
|
+
return Math.floor(date.getTime() / 1000);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function base64UrlDecode(base64Url: string): string {
|
|
31
|
+
// Replace base64url-specific characters
|
|
32
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
33
|
+
// Pad the string with '=' characters if needed
|
|
34
|
+
const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
|
|
35
|
+
const decodedString = decode(paddedBase64);
|
|
36
|
+
return decodedString;
|
|
37
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(r,n,s,o)=>{for(var e=o>1?void 0:o?m(n,s):n,t=r.length-1,u;t>=0;t--)(u=r[t])&&(e=(o?u(n,s,e):u(e))||e);return o&&e&&i(n,s,e),e};async function p(r){return new Promise(n=>{setTimeout(n,r)})}exports.a = l; exports.b = p;
|
|
2
|
-
//# sourceMappingURL=chunk-KSEUZTKY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/helpers.ts"],"names":["sleep","timeMs","resolve"],"mappings":"wMAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-GHYE26Q5.mjs";import{a as R}from"./chunk-CJDEPZ4J.mjs";var l={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(s,p){let{url:n,method:a,body:i,contentType:u,params:t,overrides:e,originMethod:o}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":u??"application/json","x-aptos-typescript-sdk-origin-method":o};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),p.provider({url:n,method:a,body:i,params:t,headers:r,overrides:e})}async function w(s,p,n){let{url:a,path:i}=s,u=i?`${a}/${i}`:a,t=await c({...s,url:u},p.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:u};if(e.status===401)throw new d(s,e,`Error: ${e.data}`);if(n==="Indexer"){let r=e.data;if(r.errors)throw new d(s,e,`Indexer error: ${r.errors[0].message}`??`Indexer unhandled Error ${t.status} : ${t.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;let o;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?o=JSON.stringify(e.data):e.status in l?o=l[e.status]:o=`Unhandled Error ${e.status} : ${e.statusText}`,new d(s,e,`${n} error: ${o}`)}export{c as a,w as b};
|
|
2
|
-
//# sourceMappingURL=chunk-2XK53QFA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"],"mappings":"AAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","names":["sleep","timeMs","resolve"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as h}from"./chunk-AF5WNJOP.mjs";import{a as y}from"./chunk-PF57EOJY.mjs";import{b as n}from"./chunk-QRS4DGP3.mjs";import{a as _}from"./chunk-36QXVFR5.mjs";var t=class i extends _{constructor(e,s,a,r,c,d,l){super(),this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=r,this.gas_unit_price=c,this.expiration_timestamp_secs=d,this.chain_id=l}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=n.deserialize(e),a=e.deserializeU64(),r=h.deserialize(e),c=e.deserializeU64(),d=e.deserializeU64(),l=e.deserializeU64(),m=y.deserialize(e);return new i(s,a,r,c,d,l,m)}},o=class extends _{static deserialize(e){let s=e.deserializeUleb128AsU32();switch(s){case 0:return u.load(e);case 1:return p.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${s}`)}}},u=class i extends o{constructor(e,s){super(),this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n);return new i(s,a)}},p=class i extends o{constructor(e,s,a){super(),this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n),r=n.deserialize(e);return new i(s,a,r)}};export{t as a,o as b,u as c,p as d};
|
|
2
|
-
//# sourceMappingURL=chunk-53INTTOI.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t}from"./chunk-56CNRT2K.mjs";var n=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<t;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(i),!(r&128))break;i+=7}if(e>t)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),r=new Array;for(let s=0;s<i;s+=1)r.push(this.deserialize(e));return r}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-6IFMQ5AS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n */\nexport interface Deserializable<T> {\n deserialize(deserializer: Deserializer): T;\n}\n\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Deserializes a string. UTF8 string is supported. Reads the string's bytes length \"l\" first,\n * and then reads \"l\" bytes of content. Decodes the byte array into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes. The number of bytes to read is already known.\n *\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value.\n *\n * BCS layout for \"boolean\": One byte. \"0x01\" for true and \"0x00\" for false.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number.\n *\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number.\n *\n * BCS layout for \"uint32\": Four bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * BCS layout for \"uint64\": Eight bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number.\n *\n * BCS layout for \"uint128\": Sixteen bytes. Binary format in little-endian representation.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number.\n *\n * BCS layout for \"uint256\": Thirty-two bytes. Binary format in little-endian representation.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer\n * instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @returns an array of deserialized values of type T\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAiBO,IAAMA,EAAN,KAAmB,CAKxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAEQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CAeA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CAQA,kBAA+B,CAC7B,IAAMC,EAAM,KAAK,wBAAwB,EACzC,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAMA,sBAAsBA,EAAyB,CAC7C,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAOA,iBAA2B,CACzB,IAAMC,EAAO,IAAI,WAAW,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAC3C,GAAIA,IAAS,GAAKA,IAAS,EACzB,MAAM,IAAI,MAAM,uBAAuB,EAEzC,OAAOA,IAAS,CAClB,CAOA,eAAuB,CACrB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAC9C,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,IAAMC,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQ,OAAOA,CAAI,GAAK,OAAO,EAAE,EAAK,OAAOD,CAAG,CAAC,CAC1D,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQA,GAAQ,OAAO,EAAE,EAAKD,CAAG,CAC1C,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,gBAAgB,EAC3BC,EAAO,KAAK,gBAAgB,EAGlC,OAAO,OAAQA,GAAQ,OAAO,GAAG,EAAKD,CAAG,CAC3C,CAOA,yBAAkC,CAChC,IAAIH,EAAgB,OAAO,CAAC,EACxBK,EAAQ,EAEZ,KAAOL,EAAQM,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAP,GAAS,OAAOO,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIL,EAAQM,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAON,CAAK,CACrB,CAeA,YAAeQ,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAyBA,kBAAqBA,EAAkC,CACrD,IAAMV,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYD,CAAG,CAAC,EAEnC,OAAOC,CACT,CACF","names":["Deserializer","data","length","bytes","value","len","bool","low","high","shift","MAX_U32_NUMBER","byte","cls","vector","i"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-U3YYSIIT.mjs";import{a as g}from"./chunk-35EWRSDK.mjs";import{a as p}from"./chunk-B7X6PSE7.mjs";import{b as y}from"./chunk-QRS4DGP3.mjs";import{a as S}from"./chunk-N3U47Y6Y.mjs";import{a as v}from"./chunk-G56GPLTB.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-SRDIYE3M.mjs";import{a as u}from"./chunk-36QXVFR5.mjs";function D(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
|
|
2
|
-
//# sourceMappingURL=chunk-AF5WNJOP.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e as o}from"./chunk-P5TZBE3L.mjs";import{a as g,b as c}from"./chunk-PIVZMT5D.mjs";var y=class a{constructor(i){let{multiKey:n,signers:s}=i;this.publicKey=n,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let r=[];for(let e of s)r.push(this.publicKey.getIndex(e.publicKey));let t=s.map((e,u)=>[e,r[u]]);t.sort((e,u)=>e[1]-u[1]),this.signers=t.map(e=>e[0]),this.signerIndicies=t.map(e=>e[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:r})}static fromPublicKeysAndSigners(i){let{publicKeys:n,signaturesRequired:s,signers:r}=i,t=new g({publicKeys:n,signaturesRequired:s});return new a({multiKey:t,signers:r})}static isMultiKeySigner(i){return i instanceof a}signWithAuthenticator(i){return new o(this.publicKey,this.sign(i))}signTransactionWithAuthenticator(i){return new o(this.publicKey,this.signTransaction(i))}sign(i){let n=[];for(let s of this.signers)n.push(s.sign(i));return new c({signatures:n,bitmap:this.signaturesBitmap})}signTransaction(i){let n=[];for(let s of this.signers)n.push(s.signTransaction(i));return new c({signatures:n,bitmap:this.signaturesBitmap})}verifySignature(i){let{message:n,signature:s}=i;if(!this.signerIndicies.every((t,e)=>e===0||t>=this.signerIndicies[e-1]))return!1;for(let t=0;t<s.signatures.length;t+=1){let e=s.signatures[t];if(!this.publicKey.publicKeys[this.signerIndicies[t]].verifySignature({message:n,signature:e}))return!1}return!0}};export{y as a};
|
|
2
|
-
//# sourceMappingURL=chunk-BBKE2QJU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}\n * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class MultiKeyAccount implements Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n */\n readonly signers: Account[];\n\n /**\n * An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n */\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * constructor for MultiKeyAccount\n *\n * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is\n * the number of required signatures.\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n constructor(args: { multiKey: MultiKey; signers: Account[] }) {\n const { multiKey, signers } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = this.publicKey.authKey().derivedAddress();\n\n // Get the index of each respective signer in the bitmap\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.publicKey));\n }\n // Zip signers and bit positions and sort signers by bit positions in order\n // to ensure the signature is signed in ascending order according to the bitmap.\n // Authentication on chain will fail otherwise.\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor for MultiKeyAccount\n *\n * @param args.publicKeys the N public keys of the MultiKeyAccount\n * @param args.signaturesRequired the number of signatures required\n * @param args.signers an array of M signers that will be used to sign the transaction\n * @returns MultiKeyAccount\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers.\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 signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param message in HexInput format\n * @returns MultiKeySignature\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers\n * @param transaction the transaction to be signed\n * @returns MultiKeySignature\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signatures signed message MultiKeySignature\n * @returns boolean\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndiciesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndiciesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"yFAuBO,IAAMA,EAAN,MAAMC,CAAmC,CAuC9C,YAAYC,EAAkD,CAC5D,GAAM,CAAE,SAAAC,EAAU,QAAAC,CAAQ,EAAIF,EAE9B,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiB,KAAK,UAAU,QAAQ,EAAE,eAAe,EAG9D,IAAME,EAAyB,CAAC,EAChC,QAAWC,KAAUF,EACnBC,EAAa,KAAK,KAAK,UAAU,SAASC,EAAO,SAAS,CAAC,EAK7D,IAAMC,EAA6CH,EAAQ,IAAI,CAACE,EAAQE,IAAU,CAACF,EAAQD,EAAaG,CAAK,CAAC,CAAC,EAC/GD,EAAsB,KAAK,CAACE,EAAGC,IAAMD,EAAE,CAAC,EAAIC,EAAE,CAAC,CAAC,EAChD,KAAK,QAAUH,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EAC5D,KAAK,eAAiBJ,EAAsB,IAAKI,GAAUA,EAAM,CAAC,CAAC,EACnE,KAAK,iBAAmB,KAAK,UAAU,aAAa,CAAE,KAAMN,CAAa,CAAC,CAC5E,CAUA,OAAO,yBAAyBH,EAIZ,CAClB,GAAM,CAAE,WAAAU,EAAY,mBAAAC,EAAoB,QAAAT,CAAQ,EAAIF,EAC9CC,EAAW,IAAIW,EAAS,CAAE,WAAAF,EAAY,mBAAAC,CAAmB,CAAC,EAChE,OAAO,IAAIZ,EAAgB,CAAE,SAAAE,EAAU,QAAAC,CAAQ,CAAC,CAClD,CAEA,OAAO,iBAAiBW,EAA8C,CACpE,OAAOA,aAAmBd,CAC5B,CAOA,sBAAsBe,EAAiD,CACrE,OAAO,IAAIC,EAA6B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC5E,CAOA,iCAAiCE,EAA8D,CAC7F,OAAO,IAAID,EAA6B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC3F,CAOA,KAAKC,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWd,KAAU,KAAK,QACxBc,EAAW,KAAKd,EAAO,KAAKa,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAOA,gBAAgBF,EAAmD,CACjE,IAAME,EAAa,CAAC,EACpB,QAAWd,KAAU,KAAK,QACxBc,EAAW,KAAKd,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIG,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBlB,EAA4C,CAC1D,GAAM,CAAE,QAAAc,EAAS,UAAAM,CAAU,EAAIpB,EAI/B,GAAI,CAH2B,KAAK,eAAe,MACjD,CAACS,EAAOY,IAAMA,IAAM,GAAKZ,GAAS,KAAK,eAAeY,EAAI,CAAC,CAC7D,EAEE,MAAO,GAET,QAASA,EAAI,EAAGA,EAAID,EAAU,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAP,EAAS,UAAWQ,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","signers","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-36QXVFR5.mjs";import{b as i}from"./chunk-BCUSI3N6.mjs";var t=class a extends r{constructor(e){super(),this.value=i.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,s){let o=e.deserializeFixedBytes(s);return new a(o)}};export{t as a};
|
|
2
|
-
//# sourceMappingURL=chunk-CEHCDA3G.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=(S=>(S.FULLNODE="Fullnode",S.INDEXER="Indexer",S.FAUCET="Faucet",S))(t||{}),E=2e5,n=20,A=20,R="0x1::aptos_coin::AptosCoin",o="APTOS::RawTransaction",T="APTOS::RawTransactionWithData",O=(_=>(_.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",_))(O||{});export{t as a,E as b,n as c,A as d,R as e,o as f,T as g,O as h};
|
|
2
|
-
//# sourceMappingURL=chunk-CYNQRMO5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 = \"Fullnode\",\n INDEXER = \"Indexer\",\n FAUCET = \"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://api.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,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,OAAS,SAHCA,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,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-53INTTOI.mjs";import{a as e}from"./chunk-O4WVPLUX.mjs";import{a as r}from"./chunk-36QXVFR5.mjs";var n=class o extends r{constructor(t,a){super(),this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-GPEM3JVU.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var o={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},n={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},s={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},e=(t=>(t.MAINNET="mainnet",t.TESTNET="testnet",t.DEVNET="devnet",t.LOCAL="local",t.CUSTOM="custom",t))(e||{}),a={mainnet:1,testnet:2,local:4},p={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};export{o as a,n as b,s as c,e as d,a as e,p as f};
|
|
2
|
-
//# sourceMappingURL=chunk-HYCGMFC2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/apiEndpoints.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport const NetworkToIndexerAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1/graphql\",\n testnet: \"https://api.testnet.aptoslabs.com/v1/graphql\",\n devnet: \"https://api.devnet.aptoslabs.com/v1/graphql\",\n local: \"http://127.0.0.1:8090/v1/graphql\",\n};\n\nexport const NetworkToNodeAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1\",\n testnet: \"https://api.testnet.aptoslabs.com/v1\",\n devnet: \"https://api.devnet.aptoslabs.com/v1\",\n local: \"http://127.0.0.1:8080/v1\",\n};\n\nexport const NetworkToFaucetAPI: Record<string, string> = {\n mainnet: \"https://faucet.mainnet.aptoslabs.com\",\n testnet: \"https://faucet.testnet.aptoslabs.com\",\n devnet: \"https://faucet.devnet.aptoslabs.com\",\n local: \"http://127.0.0.1:8081\",\n};\n\nexport enum Network {\n MAINNET = \"mainnet\",\n TESTNET = \"testnet\",\n DEVNET = \"devnet\",\n LOCAL = \"local\",\n CUSTOM = \"custom\",\n}\n\nexport const NetworkToChainId: Record<string, number> = {\n mainnet: 1,\n testnet: 2,\n local: 4,\n};\n\nexport const NetworkToNetworkName: Record<string, Network> = {\n mainnet: Network.MAINNET,\n testnet: Network.TESTNET,\n devnet: Network.DEVNET,\n local: Network.LOCAL,\n custom: Network.CUSTOM,\n};\n"],"mappings":"AAGO,IAAMA,EAA8C,CACzD,QAAS,+CACT,QAAS,+CACT,OAAQ,8CACR,MAAO,kCACT,EAEaC,EAA2C,CACtD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,MAAO,0BACT,EAEaC,EAA6C,CACxD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,MAAO,uBACT,EAEYC,OACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SALCA,OAAA,IAQCC,EAA2C,CACtD,QAAS,EACT,QAAS,EACT,MAAO,CACT,EAEaC,EAAgD,CAC3D,QAAS,UACT,QAAS,UACT,OAAQ,SACR,MAAO,QACP,OAAQ,QACV","names":["NetworkToIndexerAPI","NetworkToNodeAPI","NetworkToFaucetAPI","Network","NetworkToChainId","NetworkToNetworkName"]}
|