@aptos-labs/ts-sdk 1.14.0-zeta.3 → 1.15.0-win.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-u9wEan9p.d.ts → accountAddress-ccLvlUQe.d.ts} +22 -49
- 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 +103 -550
- package/dist/common/index.js +55 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-9zBaZEnp.d.mts → Ed25519Account-B1VMJOY2.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/MultiKeyAccount.d.mts +7 -12
- 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 +2 -8
- 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 +5 -10
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +0 -20
- 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 +2 -27
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +3 -8
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +84 -0
- package/dist/esm/api/table.mjs +2 -0
- 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 +0 -26
- 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 +0 -2
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-3CUVYW32.mjs → chunk-2X7A4HUS.mjs} +2 -2
- package/dist/esm/chunk-2XK53QFA.mjs +2 -0
- package/dist/esm/{chunk-WM2NCYZL.mjs.map → chunk-2XK53QFA.mjs.map} +1 -1
- package/dist/esm/{chunk-Y4SSUCPJ.mjs → chunk-2YZSEM2G.mjs} +2 -2
- package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-35EWRSDK.mjs} +2 -2
- package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-36QXVFR5.mjs} +2 -2
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-36QXVFR5.mjs.map} +1 -1
- package/dist/esm/chunk-3HSXKDOC.mjs +2 -0
- package/dist/esm/chunk-3HSXKDOC.mjs.map +1 -0
- package/dist/esm/chunk-3N6N3KOS.mjs +2 -0
- package/dist/esm/{chunk-HYDDIAJ6.mjs.map → chunk-3N6N3KOS.mjs.map} +1 -1
- package/dist/esm/{chunk-SLI3KELH.mjs → chunk-477G7LHJ.mjs} +2 -2
- package/dist/esm/chunk-4NHWV5AI.mjs +2 -0
- package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-5EN52MUT.mjs} +2 -2
- package/dist/esm/{chunk-P7JMD7KZ.mjs → chunk-5VIESFOC.mjs} +2 -2
- package/dist/esm/{chunk-TE3WIJ26.mjs → chunk-5YLAWRI2.mjs} +2 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +2 -0
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +1 -0
- package/dist/esm/{chunk-3CMS2KOX.mjs → chunk-6JLYD5Q2.mjs} +2 -2
- package/dist/esm/{chunk-HMFL7AOJ.mjs → chunk-6XWDDCQD.mjs} +2 -2
- package/dist/esm/{chunk-CS7B3FVO.mjs → chunk-7NEETXEA.mjs} +2 -2
- package/dist/esm/chunk-7VRZLDIJ.mjs +2 -0
- package/dist/esm/{chunk-24ZOKI52.mjs → chunk-ACG4ZGRQ.mjs} +2 -2
- package/dist/esm/chunk-AQAH67IV.mjs +2 -0
- package/dist/esm/chunk-B7X6PSE7.mjs +2 -0
- package/dist/esm/{chunk-AOCNYMMX.mjs → chunk-BCUSI3N6.mjs} +2 -2
- package/dist/esm/{chunk-HYU23YVP.mjs → chunk-BHLICYAI.mjs} +2 -2
- package/dist/esm/chunk-BO2TLWNT.mjs +2 -0
- package/dist/esm/chunk-CEHCDA3G.mjs +2 -0
- package/dist/esm/chunk-CJDEPZ4J.mjs +2 -0
- package/dist/esm/{chunk-NBEXLW7P.mjs.map → chunk-CJDEPZ4J.mjs.map} +1 -1
- package/dist/esm/{chunk-WWGROAKX.mjs → chunk-CWUH4PNH.mjs} +2 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +2 -0
- package/dist/esm/chunk-CYNQRMO5.mjs.map +1 -0
- package/dist/esm/chunk-DLAIJ2UM.mjs +2 -0
- package/dist/esm/chunk-DLAIJ2UM.mjs.map +1 -0
- package/dist/esm/{chunk-DD2VWOMZ.mjs → chunk-E2NVC2VR.mjs} +2 -2
- package/dist/esm/chunk-F7EMGK4M.mjs +2 -0
- package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-G56GPLTB.mjs} +2 -2
- package/dist/esm/{chunk-RKHPXZM6.mjs → chunk-GHYE26Q5.mjs} +2 -2
- package/dist/esm/{chunk-RKHPXZM6.mjs.map → chunk-GHYE26Q5.mjs.map} +1 -1
- package/dist/esm/{chunk-7IMWGGA6.mjs → chunk-GIAABV7R.mjs} +2 -2
- package/dist/esm/{chunk-KMKSA7LM.mjs → chunk-GKJ2NJG5.mjs} +2 -2
- package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-GM56MMNJ.mjs} +2 -2
- package/dist/esm/{chunk-GQ6HIKZT.mjs → chunk-HMARHACL.mjs} +2 -2
- package/dist/esm/chunk-HNEAPYNI.mjs +2 -0
- package/dist/esm/{chunk-P2WALKSW.mjs → chunk-HSJTQLI2.mjs} +2 -2
- package/dist/esm/chunk-HYCGMFC2.mjs +2 -0
- package/dist/esm/chunk-HYCGMFC2.mjs.map +1 -0
- package/dist/esm/chunk-IENCDVPF.mjs +2 -0
- package/dist/esm/chunk-IENCDVPF.mjs.map +1 -0
- package/dist/esm/{chunk-23MNZ5LZ.mjs → chunk-IZQV2SU6.mjs} +2 -2
- package/dist/esm/chunk-J6OFSYUA.mjs +2 -0
- package/dist/esm/chunk-J6OFSYUA.mjs.map +1 -0
- package/dist/esm/chunk-JB5H65CE.mjs +2 -0
- package/dist/esm/chunk-JB5H65CE.mjs.map +1 -0
- package/dist/esm/{chunk-XZGQMZ2H.mjs → chunk-JFIAWBCK.mjs} +2 -2
- package/dist/esm/chunk-JQIGQMNZ.mjs +2 -0
- package/dist/esm/chunk-JQIGQMNZ.mjs.map +1 -0
- package/dist/esm/chunk-K7HX7JQH.mjs +2 -0
- package/dist/esm/chunk-K7HX7JQH.mjs.map +1 -0
- package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-KAGLWBIJ.mjs} +2 -2
- package/dist/esm/chunk-LG7RJQ57.mjs +2 -0
- package/dist/esm/{chunk-HHVAU5HU.mjs → chunk-MCRRHBFQ.mjs} +2 -2
- package/dist/esm/{chunk-PFFAQZHT.mjs → chunk-MJPUASSD.mjs} +2 -2
- package/dist/esm/{chunk-7XYECSW6.mjs → chunk-MQI2IE6Y.mjs} +2 -2
- package/dist/esm/chunk-N3U47Y6Y.mjs +2 -0
- package/dist/esm/{chunk-L5WUYZ35.mjs → chunk-NZETF6Z4.mjs} +2 -2
- package/dist/esm/chunk-OWW6SIDP.mjs +2 -0
- package/dist/esm/chunk-OWW6SIDP.mjs.map +1 -0
- package/dist/esm/{chunk-CB6CNNM2.mjs → chunk-P6GWG2CY.mjs} +2 -2
- package/dist/esm/chunk-PF57EOJY.mjs +2 -0
- package/dist/esm/{chunk-JLWKIYHV.mjs → chunk-PIVZMT5D.mjs} +2 -2
- package/dist/esm/{chunk-R52BRP36.mjs → chunk-PLXGSUZA.mjs} +2 -2
- package/dist/esm/{chunk-AHNE2QA3.mjs → chunk-PPO4IXE4.mjs} +2 -2
- package/dist/esm/{chunk-PMPTAPM3.mjs → chunk-QIHR7HD6.mjs} +2 -2
- package/dist/esm/{chunk-BTLFW3YY.mjs → chunk-QQ5PHEJF.mjs} +2 -2
- package/dist/esm/{chunk-T23OVRNF.mjs → chunk-QRS4DGP3.mjs} +2 -2
- package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-QRS4DGP3.mjs.map} +1 -1
- package/dist/esm/{chunk-LDQ6JFEF.mjs → chunk-QSHLNSUP.mjs} +2 -2
- package/dist/esm/{chunk-LDQ6JFEF.mjs.map → chunk-QSHLNSUP.mjs.map} +1 -1
- package/dist/esm/chunk-ROXFCLDT.mjs +2 -0
- package/dist/esm/chunk-RTSWVT2Q.mjs +2 -0
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +1 -0
- package/dist/esm/{chunk-Y33CIIZX.mjs → chunk-RVWYURXG.mjs} +2 -2
- package/dist/esm/{chunk-U5C2PXC6.mjs → chunk-RYD6HRW7.mjs} +2 -2
- package/dist/esm/chunk-S2VSJJRJ.mjs +2 -0
- package/dist/esm/chunk-S2VSJJRJ.mjs.map +1 -0
- package/dist/esm/{chunk-S4SEFF4K.mjs → chunk-S3EDNXZE.mjs} +46 -17
- package/dist/esm/chunk-S3EDNXZE.mjs.map +1 -0
- package/dist/esm/chunk-SRDIYE3M.mjs +2 -0
- package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-SRDIYE3M.mjs.map} +1 -1
- package/dist/esm/{chunk-SI7MPP6G.mjs → chunk-T2AGN5YT.mjs} +2 -2
- package/dist/esm/chunk-TGQARO3F.mjs +2 -0
- package/dist/esm/chunk-TGQARO3F.mjs.map +1 -0
- package/dist/esm/chunk-TM7NDDT3.mjs +2 -0
- package/dist/esm/chunk-TM7NDDT3.mjs.map +1 -0
- package/dist/esm/{chunk-HSFG2AIK.mjs → chunk-TT2XR5ZI.mjs} +2 -2
- package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-U3YYSIIT.mjs} +2 -2
- package/dist/esm/chunk-UGPALAPN.mjs +2 -0
- package/dist/esm/{chunk-7SIQDOYY.mjs → chunk-UKSRF2Q3.mjs} +2 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +1 -0
- package/dist/esm/{chunk-TICM455H.mjs → chunk-UPSCPEEE.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/chunk-WXWWYH73.mjs +2 -0
- package/dist/esm/chunk-WXWWYH73.mjs.map +1 -0
- package/dist/esm/{chunk-O3PLAAN7.mjs → chunk-XBHFMNYB.mjs} +2 -2
- package/dist/esm/{chunk-GNNNICLW.mjs → chunk-XD46HTI2.mjs} +2 -2
- package/dist/esm/{chunk-6WIB3GGF.mjs → chunk-XFSDV3ND.mjs} +2 -2
- package/dist/esm/chunk-YMB2XW2O.mjs +2 -0
- package/dist/esm/{chunk-YNNPWCF6.mjs.map → chunk-YMB2XW2O.mjs.map} +1 -1
- package/dist/esm/{chunk-ZPMS2Q37.mjs → chunk-ZBXOX3S7.mjs} +2 -2
- package/dist/esm/cli/index.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 +1 -2
- 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 +1 -3
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +1 -5
- 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/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -4
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +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 +1 -4
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +9 -14
- 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.d.mts +2 -8
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +31 -0
- package/dist/esm/internal/table.mjs +2 -0
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +1 -1
- package/dist/esm/types/generated/operations.d.mts +31 -2
- package/dist/esm/types/generated/queries.d.mts +6 -2
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.d.mts +212 -7
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +4 -20
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +4 -2
- package/dist/esm/utils/apiEndpoints.d.mts +1 -3
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +1 -3
- 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/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -11
- package/src/account/MultiKeyAccount.ts +0 -10
- package/src/account/index.ts +0 -2
- package/src/api/aptos.ts +5 -5
- package/src/api/aptosConfig.ts +1 -46
- package/src/api/general.ts +0 -26
- package/src/api/table.ts +108 -0
- package/src/bcs/deserializer.ts +0 -40
- package/src/bcs/serializer.ts +0 -18
- package/src/cli/move.ts +1 -1
- package/src/client/core.ts +0 -8
- package/src/client/get.ts +0 -6
- package/src/client/post.ts +0 -12
- package/src/client/types.ts +1 -1
- package/src/core/crypto/index.ts +0 -2
- package/src/core/crypto/singleKey.ts +0 -11
- package/src/internal/account.ts +2 -1
- package/src/internal/general.ts +1 -20
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +1 -0
- package/src/internal/queries/getTableItemsData.graphql +15 -0
- package/src/internal/queries/getTableItemsMetadata.graphql +12 -0
- package/src/internal/table.ts +82 -0
- package/src/internal/transactionSubmission.ts +7 -20
- package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -16
- package/src/types/generated/operations.ts +29 -0
- package/src/types/generated/queries.ts +59 -0
- package/src/types/generated/types.ts +223 -4
- package/src/types/index.ts +0 -22
- package/src/types/indexer.ts +4 -0
- package/src/utils/apiEndpoints.ts +0 -14
- package/src/utils/const.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +0 -80
- package/dist/esm/account/EphemeralKeyPair.mjs +0 -2
- package/dist/esm/account/KeylessAccount.d.mts +0 -145
- package/dist/esm/account/KeylessAccount.mjs +0 -2
- package/dist/esm/api/keyless.d.mts +0 -81
- package/dist/esm/api/keyless.mjs +0 -2
- package/dist/esm/chunk-25H3DXTL.mjs +0 -2
- package/dist/esm/chunk-25H3DXTL.mjs.map +0 -1
- package/dist/esm/chunk-2ECWQRBB.mjs +0 -2
- package/dist/esm/chunk-2HD2G4AH.mjs +0 -2
- package/dist/esm/chunk-2HD2G4AH.mjs.map +0 -1
- package/dist/esm/chunk-3COVJN6Z.mjs +0 -2
- package/dist/esm/chunk-3COVJN6Z.mjs.map +0 -1
- package/dist/esm/chunk-3FVRXELT.mjs +0 -2
- package/dist/esm/chunk-3S3GIUQY.mjs +0 -2
- package/dist/esm/chunk-5XOFEQWC.mjs +0 -2
- package/dist/esm/chunk-6RBUXB5I.mjs +0 -2
- package/dist/esm/chunk-75J7H3XD.mjs +0 -2
- package/dist/esm/chunk-75J7H3XD.mjs.map +0 -1
- package/dist/esm/chunk-7KOC7VNK.mjs +0 -2
- package/dist/esm/chunk-7KOC7VNK.mjs.map +0 -1
- package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
- package/dist/esm/chunk-AJ7UC2G3.mjs +0 -2
- package/dist/esm/chunk-AJ7UC2G3.mjs.map +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +0 -1
- package/dist/esm/chunk-C3L4ETUF.mjs +0 -2
- package/dist/esm/chunk-CO53EOHE.mjs +0 -2
- package/dist/esm/chunk-CO53EOHE.mjs.map +0 -1
- package/dist/esm/chunk-COW5IGYC.mjs +0 -2
- package/dist/esm/chunk-FBPNHF54.mjs +0 -2
- package/dist/esm/chunk-FLYEALDB.mjs +0 -2
- package/dist/esm/chunk-FLYEALDB.mjs.map +0 -1
- package/dist/esm/chunk-H62IKYXG.mjs +0 -2
- package/dist/esm/chunk-HYDDIAJ6.mjs +0 -2
- package/dist/esm/chunk-JM2B5E2I.mjs +0 -2
- package/dist/esm/chunk-JM2B5E2I.mjs.map +0 -1
- package/dist/esm/chunk-JM544NRW.mjs +0 -2
- package/dist/esm/chunk-JM544NRW.mjs.map +0 -1
- package/dist/esm/chunk-MGOHPDX4.mjs +0 -2
- package/dist/esm/chunk-MOKAU77C.mjs +0 -2
- package/dist/esm/chunk-MOKAU77C.mjs.map +0 -1
- package/dist/esm/chunk-MWUJCP27.mjs +0 -2
- package/dist/esm/chunk-N466X3S6.mjs +0 -2
- package/dist/esm/chunk-N466X3S6.mjs.map +0 -1
- package/dist/esm/chunk-NBEXLW7P.mjs +0 -2
- package/dist/esm/chunk-PGCBIU33.mjs +0 -2
- package/dist/esm/chunk-PGCBIU33.mjs.map +0 -1
- package/dist/esm/chunk-PYUWGGAW.mjs +0 -2
- package/dist/esm/chunk-PYUWGGAW.mjs.map +0 -1
- package/dist/esm/chunk-RKTM5GBP.mjs +0 -2
- package/dist/esm/chunk-RKTM5GBP.mjs.map +0 -1
- package/dist/esm/chunk-S4SEFF4K.mjs.map +0 -1
- package/dist/esm/chunk-STYDBDYL.mjs +0 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +0 -2
- package/dist/esm/chunk-UTXJOB3O.mjs +0 -2
- package/dist/esm/chunk-VL6EYA53.mjs +0 -2
- package/dist/esm/chunk-VL6EYA53.mjs.map +0 -1
- package/dist/esm/chunk-VPKPQBKL.mjs +0 -2
- package/dist/esm/chunk-VPKPQBKL.mjs.map +0 -1
- package/dist/esm/chunk-VSD2AWUR.mjs +0 -2
- package/dist/esm/chunk-VSD2AWUR.mjs.map +0 -1
- package/dist/esm/chunk-VT6XJSRO.mjs +0 -2
- package/dist/esm/chunk-VT6XJSRO.mjs.map +0 -1
- package/dist/esm/chunk-WM2NCYZL.mjs +0 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +0 -2
- package/dist/esm/chunk-YE5B2S5L.mjs.map +0 -1
- package/dist/esm/chunk-YGOJYDJA.mjs +0 -2
- package/dist/esm/chunk-YGOJYDJA.mjs.map +0 -1
- package/dist/esm/chunk-YNNPWCF6.mjs +0 -2
- package/dist/esm/chunk-YV7OBLK2.mjs +0 -2
- package/dist/esm/chunk-YV7OBLK2.mjs.map +0 -1
- package/dist/esm/chunk-ZKRG4C4U.mjs +0 -2
- package/dist/esm/chunk-ZKRG4C4U.mjs.map +0 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +0 -73
- package/dist/esm/core/crypto/ephemeral.mjs +0 -2
- package/dist/esm/core/crypto/ephemeral.mjs.map +0 -1
- package/dist/esm/core/crypto/keyless.d.mts +0 -232
- package/dist/esm/core/crypto/keyless.mjs +0 -2
- package/dist/esm/core/crypto/keyless.mjs.map +0 -1
- package/dist/esm/core/crypto/poseidon.d.mts +0 -7
- package/dist/esm/core/crypto/poseidon.mjs +0 -2
- package/dist/esm/core/crypto/poseidon.mjs.map +0 -1
- package/dist/esm/core/crypto/proof.d.mts +0 -21
- package/dist/esm/core/crypto/proof.mjs +0 -2
- package/dist/esm/core/crypto/proof.mjs.map +0 -1
- package/dist/esm/internal/keyless.d.mts +0 -68
- package/dist/esm/internal/keyless.mjs +0 -2
- package/dist/esm/internal/keyless.mjs.map +0 -1
- package/dist/esm/types/keyless.d.mts +0 -69
- package/dist/esm/types/keyless.mjs +0 -2
- package/dist/esm/types/keyless.mjs.map +0 -1
- package/src/account/EphemeralKeyPair.ts +0 -161
- package/src/account/KeylessAccount.ts +0 -341
- package/src/api/keyless.ts +0 -48
- package/src/core/crypto/ephemeral.ts +0 -138
- package/src/core/crypto/keyless.ts +0 -453
- package/src/core/crypto/poseidon.ts +0 -134
- package/src/core/crypto/proof.ts +0 -16
- package/src/internal/keyless.ts +0 -119
- package/src/types/keyless.ts +0 -37
- /package/dist/esm/{account/EphemeralKeyPair.mjs.map → api/table.mjs.map} +0 -0
- /package/dist/esm/{chunk-3CUVYW32.mjs.map → chunk-2X7A4HUS.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4SSUCPJ.mjs.map → chunk-2YZSEM2G.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-35EWRSDK.mjs.map} +0 -0
- /package/dist/esm/{chunk-SLI3KELH.mjs.map → chunk-477G7LHJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-4NHWV5AI.mjs.map} +0 -0
- /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-5EN52MUT.mjs.map} +0 -0
- /package/dist/esm/{chunk-P7JMD7KZ.mjs.map → chunk-5VIESFOC.mjs.map} +0 -0
- /package/dist/esm/{chunk-TE3WIJ26.mjs.map → chunk-5YLAWRI2.mjs.map} +0 -0
- /package/dist/esm/{chunk-3CMS2KOX.mjs.map → chunk-6JLYD5Q2.mjs.map} +0 -0
- /package/dist/esm/{chunk-HMFL7AOJ.mjs.map → chunk-6XWDDCQD.mjs.map} +0 -0
- /package/dist/esm/{chunk-CS7B3FVO.mjs.map → chunk-7NEETXEA.mjs.map} +0 -0
- /package/dist/esm/{chunk-H62IKYXG.mjs.map → chunk-7VRZLDIJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-24ZOKI52.mjs.map → chunk-ACG4ZGRQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3S3GIUQY.mjs.map → chunk-AQAH67IV.mjs.map} +0 -0
- /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-B7X6PSE7.mjs.map} +0 -0
- /package/dist/esm/{chunk-AOCNYMMX.mjs.map → chunk-BCUSI3N6.mjs.map} +0 -0
- /package/dist/esm/{chunk-HYU23YVP.mjs.map → chunk-BHLICYAI.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ECWQRBB.mjs.map → chunk-BO2TLWNT.mjs.map} +0 -0
- /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-CEHCDA3G.mjs.map} +0 -0
- /package/dist/esm/{chunk-WWGROAKX.mjs.map → chunk-CWUH4PNH.mjs.map} +0 -0
- /package/dist/esm/{chunk-DD2VWOMZ.mjs.map → chunk-E2NVC2VR.mjs.map} +0 -0
- /package/dist/esm/{chunk-TJDC5PWD.mjs.map → chunk-F7EMGK4M.mjs.map} +0 -0
- /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-G56GPLTB.mjs.map} +0 -0
- /package/dist/esm/{chunk-7IMWGGA6.mjs.map → chunk-GIAABV7R.mjs.map} +0 -0
- /package/dist/esm/{chunk-KMKSA7LM.mjs.map → chunk-GKJ2NJG5.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-GM56MMNJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-GQ6HIKZT.mjs.map → chunk-HMARHACL.mjs.map} +0 -0
- /package/dist/esm/{chunk-5XOFEQWC.mjs.map → chunk-HNEAPYNI.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2WALKSW.mjs.map → chunk-HSJTQLI2.mjs.map} +0 -0
- /package/dist/esm/{chunk-23MNZ5LZ.mjs.map → chunk-IZQV2SU6.mjs.map} +0 -0
- /package/dist/esm/{chunk-XZGQMZ2H.mjs.map → chunk-JFIAWBCK.mjs.map} +0 -0
- /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-KAGLWBIJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-LG7RJQ57.mjs.map} +0 -0
- /package/dist/esm/{chunk-HHVAU5HU.mjs.map → chunk-MCRRHBFQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-PFFAQZHT.mjs.map → chunk-MJPUASSD.mjs.map} +0 -0
- /package/dist/esm/{chunk-7XYECSW6.mjs.map → chunk-MQI2IE6Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-N3U47Y6Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-L5WUYZ35.mjs.map → chunk-NZETF6Z4.mjs.map} +0 -0
- /package/dist/esm/{chunk-CB6CNNM2.mjs.map → chunk-P6GWG2CY.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-PF57EOJY.mjs.map} +0 -0
- /package/dist/esm/{chunk-JLWKIYHV.mjs.map → chunk-PIVZMT5D.mjs.map} +0 -0
- /package/dist/esm/{chunk-R52BRP36.mjs.map → chunk-PLXGSUZA.mjs.map} +0 -0
- /package/dist/esm/{chunk-AHNE2QA3.mjs.map → chunk-PPO4IXE4.mjs.map} +0 -0
- /package/dist/esm/{chunk-PMPTAPM3.mjs.map → chunk-QIHR7HD6.mjs.map} +0 -0
- /package/dist/esm/{chunk-BTLFW3YY.mjs.map → chunk-QQ5PHEJF.mjs.map} +0 -0
- /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-ROXFCLDT.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y33CIIZX.mjs.map → chunk-RVWYURXG.mjs.map} +0 -0
- /package/dist/esm/{chunk-U5C2PXC6.mjs.map → chunk-RYD6HRW7.mjs.map} +0 -0
- /package/dist/esm/{chunk-SI7MPP6G.mjs.map → chunk-T2AGN5YT.mjs.map} +0 -0
- /package/dist/esm/{chunk-HSFG2AIK.mjs.map → chunk-TT2XR5ZI.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-U3YYSIIT.mjs.map} +0 -0
- /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-UGPALAPN.mjs.map} +0 -0
- /package/dist/esm/{chunk-7SIQDOYY.mjs.map → chunk-UKSRF2Q3.mjs.map} +0 -0
- /package/dist/esm/{account/KeylessAccount.mjs.map → chunk-UO3NZ5AH.mjs.map} +0 -0
- /package/dist/esm/{chunk-TICM455H.mjs.map → chunk-UPSCPEEE.mjs.map} +0 -0
- /package/dist/esm/{api/keyless.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
- /package/dist/esm/{chunk-O3PLAAN7.mjs.map → chunk-XBHFMNYB.mjs.map} +0 -0
- /package/dist/esm/{chunk-GNNNICLW.mjs.map → chunk-XD46HTI2.mjs.map} +0 -0
- /package/dist/esm/{chunk-6WIB3GGF.mjs.map → chunk-XFSDV3ND.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZPMS2Q37.mjs.map → chunk-ZBXOX3S7.mjs.map} +0 -0
- /package/dist/esm/{chunk-7Z6DYLCA.mjs.map → internal/table.mjs.map} +0 -0
- /package/dist/esm/{publicKey-lq5djCIY.d.mts → publicKey-B3XRNhHO.d.mts} +0 -0
|
@@ -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\";\nimport { KeylessAccount } from \"./KeylessAccount\";\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 * Waits for any proofs to be fetched\n * @return\n */\n async waitForProofFetch() {\n const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];\n await Promise.all(keylessSigners.filter((signer) => signer.proof instanceof Promise).map((signer) => signer.proof));\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":"kIAwBO,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,CAMA,MAAM,mBAAoB,CACxB,IAAMC,EAAiB,KAAK,QAAQ,OAAQb,GAAWA,aAAkBc,CAAc,EACvF,MAAM,QAAQ,IAAID,EAAe,OAAQb,GAAWA,EAAO,iBAAiB,OAAO,EAAE,IAAKA,GAAWA,EAAO,KAAK,CAAC,CACpH,CAOA,KAAKe,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,KAAKe,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAOA,gBAAgBJ,EAAmD,CACjE,IAAMI,EAAa,CAAC,EACpB,QAAWhB,KAAU,KAAK,QACxBgB,EAAW,KAAKhB,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIK,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBpB,EAA4C,CAC1D,GAAM,CAAE,QAAAc,EAAS,UAAAQ,CAAU,EAAItB,EAI/B,GAAI,CAH2B,KAAK,eAAe,MACjD,CAACS,EAAOc,IAAMA,IAAM,GAAKd,GAAS,KAAK,eAAec,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,QAAAT,EAAS,UAAWU,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","keylessSigners","KeylessAccount","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as v}from"./chunk-RKTM5GBP.mjs";import{a as x,c as k}from"./chunk-XZGQMZ2H.mjs";import{d as g}from"./chunk-HYDDIAJ6.mjs";import{a as y,b as m}from"./chunk-YV7OBLK2.mjs";import{i as E,j as b,k as A,n as f}from"./chunk-PGCBIU33.mjs";import{b as F}from"./chunk-T23OVRNF.mjs";import{a as K}from"./chunk-VT6XJSRO.mjs";import{a as u}from"./chunk-TVRJ3M7B.mjs";import{b as S}from"./chunk-AOCNYMMX.mjs";import{jwtDecode as T}from"jwt-decode";import{JwksClient as H}from"jwks-rsa";import{decode as Z}from"js-base64";import C from"eventemitter3";var J={"https://accounts.google.com":"https://www.googleapis.com/oauth2/v3/certs"},s=class s extends u{constructor(e){super();let{address:r,ephemeralKeyPair:t,uidKey:i,uidVal:n,aud:a,pepper:p,proofOrFetcher:o,proofFetchCallback:l,jwt:d}=e;if(this.ephemeralKeyPair=t,this.publicKey=E.create(e),this.accountAddress=r?F.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=i,this.uidVal=n,this.aud=a,this.jwt=d,this.emitter=new C,this.proofOrPromise=o,o instanceof f)this.proof=o;else{if(l===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async z=>{await l(z),this.emitter.removeAllListeners()}),this.init(o)}this.signingScheme=2;let h=S.fromHexInput(p).toUint8Array();if(h.length!==s.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${s.PEPPER_LENGTH}`);this.pepper=h,this.isJwtValid=!0}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),t=e.deserializeStr(),i=e.deserializeFixedBytes(31),n=v.deserialize(e),a=f.deserialize(e);return s.fromJWTAndProof({proof:a,pepper:i,uidKey:t,jwt:r,ephemeralKeyPair:n})}isExpired(){return this.ephemeralKeyPair.isExpired()}async checkJwkValidity(){if(!this.isJwtValid)return!1;let e=T(this.jwt,{header:!0}),r=new H({jwksUri:J[this.publicKey.iss]});try{return await r.getSigningKey(e.kid),!0}catch{return this.isJwtValid=!1,!1}}signWithAuthenticator(e){let r=new m(this.sign(e)),t=new y(this.publicKey);return new g(t,r)}signTransactionWithAuthenticator(e){let r=new m(this.signTransaction(e)),t=new y(this.publicKey);return new g(t,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("Ephemeral key pair is expired.");if(this.proof===void 0)throw new Error("Proof not found");if(!this.isJwtValid)throw new Error("The proof has expired. Please refetch proof");let t=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new b({jwtHeader:V(this.jwt.split(".")[0]),ephemeralCertificate:new A(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:t,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=x(e),t=new w(r,this.proof.proof),i=k(t);return this.sign(i)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return s.deserialize(new K(e))}static fromJWTAndProof(e){let{proof:r,jwt:t,ephemeralKeyPair:i,pepper:n,proofFetchCallback:a}=e,p=e.uidKey??"sub",o=T(t),l=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let d=o.aud,h=o[p];return new s({proofOrFetcher:r,ephemeralKeyPair:i,iss:l,uidKey:p,uidVal:h,aud:d,pepper:n,jwt:t,proofFetchCallback:a})}};s.PEPPER_LENGTH=31;var j=s,w=class extends u{constructor(e,r){super();this.transaction=e,this.proof=r}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}};function V(P){let c=P.replace(/-/g,"+").replace(/_/g,"/"),e=c+"==".substring(0,(3-c.length%3)%3);return Z(e)}export{J as a,j as b};
|
|
2
|
-
//# sourceMappingURL=chunk-VSD2AWUR.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { JwksClient } from \"jwks-rsa\";\nimport { decode } from \"js-base64\";\nimport EventEmitter from \"eventemitter3\";\nimport { EphemeralCertificateVariant, HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n EphemeralCertificate,\n Signature,\n ZeroKnowledgeSig,\n ZkProof,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport {\n deriveTransactionType,\n generateSigningMessageForSerializable,\n} from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../transactions/types\";\n\nexport const IssuerToJwkEndpoint: Record<string, string> = {\n \"https://accounts.google.com\": \"https://www.googleapis.com/oauth2/v3/certs\",\n};\n\nexport class KeylessAccount extends Serializable implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n readonly publicKey: KeylessPublicKey;\n\n readonly ephemeralKeyPair: EphemeralKeyPair;\n\n readonly uidKey: string;\n\n readonly uidVal: string;\n\n readonly aud: string;\n\n readonly pepper: Uint8Array;\n\n readonly accountAddress: AccountAddress;\n\n proof: ZeroKnowledgeSig | undefined;\n\n readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n\n readonly signingScheme: SigningScheme;\n\n private jwt: string;\n\n private isJwtValid: boolean;\n\n readonly emitter: EventEmitter<ProofFetchEvents>;\n\n constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proofOrFetcher: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n }) {\n super();\n const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n this.publicKey = KeylessPublicKey.create(args);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proofOrFetcher;\n if (proofOrFetcher instanceof ZeroKnowledgeSig) {\n this.proof = proofOrFetcher;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback for async proof fetch\");\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n this.init(proofOrFetcher);\n }\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n this.isJwtValid = true;\n }\n\n /**\n * This initializes the asyncronous proof fetch\n * @return\n */\n async init(promise: Promise<ZeroKnowledgeSig>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", { status: \"Success\" });\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: error.toString() });\n } else {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: \"Unknown\" });\n }\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Connot serialize - proof undefined\");\n }\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return KeylessAccount.fromJWTAndProof({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n /**\n * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair\n * and JWT token.\n * @return boolean\n */\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n /**\n * Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.\n * Caches the result.\n * @return boolean\n */\n async checkJwkValidity(): Promise<boolean> {\n if (!this.isJwtValid) {\n return false;\n }\n const jwtHeader = jwtDecode(this.jwt, { header: true });\n const client = new JwksClient({\n jwksUri: IssuerToJwkEndpoint[this.publicKey.iss],\n });\n try {\n await client.getSigningKey(jwtHeader.kid);\n return true;\n } catch (error) {\n this.isJwtValid = false;\n return false;\n }\n }\n\n /**\n * Sign a message using Keyless.\n * @param message the message to sign, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.sign(message));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Sign a transaction using Keyless.\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): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.signTransaction(transaction));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Waits for asyncronous proof fetching to finish.\n * @return\n */\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n /**\n * Sign the given message using Keyless.\n * @param message in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): KeylessSignature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n if (this.isExpired()) {\n throw new Error(\"Ephemeral key pair is expired.\");\n }\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n if (!this.isJwtValid) {\n throw new Error(\"The proof has expired. Please refetch proof\");\n }\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(this.jwt.split(\".\")[0]),\n ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n /**\n * Sign the given transaction with Keyless.\n * Signs the transaction and proof to guard against proof malleability.\n * @param transaction the transaction to be signed\n * @returns KeylessSignature\n */\n signTransaction(transaction: AnyRawTransaction): KeylessSignature {\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n const raw = deriveTransactionType(transaction);\n const txnAndProof = new TransactionAndProof(raw, this.proof.proof);\n const signMess = generateSigningMessageForSerializable(txnAndProof);\n return this.sign(signMess);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n throw new Error(\"Not implemented\");\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(bytes));\n }\n\n static fromJWTAndProof(args: {\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): KeylessAccount {\n const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;\n const uidKey = args.uidKey ?? \"sub\";\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n const iss = jwtPayload.iss!;\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const aud = jwtPayload.aud!;\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n proofOrFetcher: proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n}\n\nclass TransactionAndProof extends Serializable {\n transaction: AnyRawTransactionInstance;\n\n proof?: ZkProof;\n\n constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {\n super();\n this.transaction = transaction;\n this.proof = proof;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.transaction.bcsToBytes());\n serializer.serializeOption(this.proof);\n }\n}\n\nfunction base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n"],"mappings":"oZAGA,OAAqB,aAAAA,MAAiB,aACtC,OAAS,cAAAC,MAAkB,WAC3B,OAAS,UAAAC,MAAc,YACvB,OAAOC,MAAkB,gBAyBlB,IAAMC,EAA8C,CACzD,8BAA+B,4CACjC,EAEaC,EAAN,MAAMA,UAAuBC,CAAgC,CA6BlE,YAAYC,EAWT,CACD,MAAM,EACN,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,OAAAC,EAAQ,OAAAC,EAAQ,IAAAC,EAAK,OAAAC,EAAQ,eAAAC,EAAgB,mBAAAC,EAAoB,IAAAC,CAAI,EAAIT,EAU5G,GATA,KAAK,iBAAmBE,EACxB,KAAK,UAAYQ,EAAiB,OAAOV,CAAI,EAC7C,KAAK,eAAiBC,EAAUU,EAAe,KAAKV,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,EACvG,KAAK,OAASE,EACd,KAAK,OAASC,EACd,KAAK,IAAMC,EACX,KAAK,IAAMI,EACX,KAAK,QAAU,IAAIG,EACnB,KAAK,eAAiBL,EAClBA,aAA0BM,EAC5B,KAAK,MAAQN,MACR,CACL,GAAIC,IAAuB,OACzB,MAAM,IAAI,MAAM,6CAA6C,EAE/D,KAAK,QAAQ,GAAG,mBAAoB,MAAOM,GAAW,CACpD,MAAMN,EAAmBM,CAAM,EAC/B,KAAK,QAAQ,mBAAmB,CAClC,CAAC,EACD,KAAK,KAAKP,CAAc,CAC1B,CACA,KAAK,cAAgB,EACrB,IAAMQ,EAAcC,EAAI,aAAaV,CAAM,EAAE,aAAa,EAC1D,GAAIS,EAAY,SAAWjB,EAAe,cACxC,MAAM,IAAI,MAAM,oCAAoCA,EAAe,aAAa,EAAE,EAEpF,KAAK,OAASiB,EACd,KAAK,WAAa,EACpB,CAMA,MAAM,KAAKE,EAAoC,CAC7C,GAAI,CACF,KAAK,MAAQ,MAAMA,EACnB,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQ,SAAU,CAAC,CAC7D,OAASC,EAAO,CACVA,aAAiB,MACnB,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQ,SAAU,MAAOA,EAAM,SAAS,CAAE,CAAC,EAEnF,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQ,SAAU,MAAO,SAAU,CAAC,CAEhF,CACF,CAEA,UAAUC,EAA8B,CAKtC,GAJAA,EAAW,aAAa,KAAK,GAAG,EAChCA,EAAW,aAAa,KAAK,MAAM,EACnCA,EAAW,oBAAoB,KAAK,MAAM,EAC1C,KAAK,iBAAiB,UAAUA,CAAU,EACtC,KAAK,QAAU,OACjB,MAAM,IAAI,MAAM,oCAAoC,EAEtD,KAAK,MAAM,UAAUA,CAAU,CACjC,CAEA,OAAO,YAAYC,EAA4C,CAC7D,IAAMX,EAAMW,EAAa,eAAe,EAClCjB,EAASiB,EAAa,eAAe,EACrCd,EAASc,EAAa,sBAAsB,EAAE,EAC9ClB,EAAmBmB,EAAiB,YAAYD,CAAY,EAC5DE,EAAQT,EAAiB,YAAYO,CAAY,EACvD,OAAOtB,EAAe,gBAAgB,CACpC,MAAAwB,EACA,OAAAhB,EACA,OAAAH,EACA,IAAAM,EACA,iBAAAP,CACF,CAAC,CACH,CAOA,WAAqB,CACnB,OAAO,KAAK,iBAAiB,UAAU,CACzC,CAOA,MAAM,kBAAqC,CACzC,GAAI,CAAC,KAAK,WACR,MAAO,GAET,IAAMqB,EAAYC,EAAU,KAAK,IAAK,CAAE,OAAQ,EAAK,CAAC,EAChDC,EAAS,IAAIC,EAAW,CAC5B,QAAS7B,EAAoB,KAAK,UAAU,GAAG,CACjD,CAAC,EACD,GAAI,CACF,aAAM4B,EAAO,cAAcF,EAAU,GAAG,EACjC,EACT,MAAgB,CACd,YAAK,WAAa,GACX,EACT,CACF,CAOA,sBAAsBI,EAAkD,CACtE,IAAMC,EAAY,IAAIC,EAAa,KAAK,KAAKF,CAAO,CAAC,EAC/CG,EAAY,IAAIC,EAAa,KAAK,SAAS,EACjD,OAAO,IAAIC,EAA8BF,EAAWF,CAAS,CAC/D,CAOA,iCAAiCK,EAA+D,CAC9F,IAAML,EAAY,IAAIC,EAAa,KAAK,gBAAgBI,CAAW,CAAC,EAC9DH,EAAY,IAAIC,EAAa,KAAK,SAAS,EACjD,OAAO,IAAIC,EAA8BF,EAAWF,CAAS,CAC/D,CAMA,MAAM,mBAAoB,CACpB,KAAK,0BAA0B,SACjC,MAAM,KAAK,cAEf,CAOA,KAAKM,EAAkC,CACrC,GAAM,CAAE,eAAAC,CAAe,EAAI,KAAK,iBAChC,GAAI,KAAK,UAAU,EACjB,MAAM,IAAI,MAAM,gCAAgC,EAElD,GAAI,KAAK,QAAU,OACjB,MAAM,IAAI,MAAM,iBAAiB,EAEnC,GAAI,CAAC,KAAK,WACR,MAAM,IAAI,MAAM,6CAA6C,EAE/D,IAAMC,EAAqB,KAAK,iBAAiB,aAAa,EACxDC,EAAqB,KAAK,iBAAiB,KAAKH,CAAI,EAE1D,OAAO,IAAII,EAAiB,CAC1B,UAAWC,EAAgB,KAAK,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,EACjD,qBAAsB,IAAIC,EAAqB,KAAK,OAA0C,EAC9F,eAAAL,EACA,mBAAAC,EACA,mBAAAC,CACF,CAAC,CACH,CAQA,gBAAgBJ,EAAkD,CAChE,GAAI,KAAK,QAAU,OACjB,MAAM,IAAI,MAAM,iBAAiB,EAEnC,IAAMQ,EAAMC,EAAsBT,CAAW,EACvCU,EAAc,IAAIC,EAAoBH,EAAK,KAAK,MAAM,KAAK,EAC3DI,EAAWC,EAAsCH,CAAW,EAClE,OAAO,KAAK,KAAKE,CAAQ,CAC3B,CAGA,gBAAgB7C,EAA4D,CAC1E,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAEA,OAAO,UAAU+C,EAAmC,CAClD,OAAOjD,EAAe,YAAY,IAAIkD,EAAaD,CAAK,CAAC,CAC3D,CAEA,OAAO,gBAAgB/C,EAOJ,CACjB,GAAM,CAAE,MAAAsB,EAAO,IAAAb,EAAK,iBAAAP,EAAkB,OAAAI,EAAQ,mBAAAE,CAAmB,EAAIR,EAC/DG,EAASH,EAAK,QAAU,MAExBiD,EAAazB,EAAkDf,CAAG,EAClEyC,EAAMD,EAAW,IACvB,GAAI,OAAOA,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,yCAAyC,EAE3D,IAAM5C,EAAM4C,EAAW,IACjB7C,EAAS6C,EAAW9C,CAAM,EAChC,OAAO,IAAIL,EAAe,CACxB,eAAgBwB,EAChB,iBAAApB,EACA,IAAAgD,EACA,OAAA/C,EACA,OAAAC,EACA,IAAAC,EACA,OAAAC,EACA,IAAAG,EACA,mBAAAD,CACF,CAAC,CACH,CACF,EAtQaV,EACK,cAAwB,GADnC,IAAMqD,EAANrD,EAwQD8C,EAAN,cAAkC7C,CAAa,CAK7C,YAAYkC,EAAwCX,EAAiB,CACnE,MAAM,EACN,KAAK,YAAcW,EACnB,KAAK,MAAQX,CACf,CAEA,UAAUH,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,YAAY,WAAW,CAAC,EAC5DA,EAAW,gBAAgB,KAAK,KAAK,CACvC,CACF,EAEA,SAASoB,EAAgBa,EAA2B,CAElD,IAAMC,EAASD,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAEvDE,EAAeD,EAAS,KAAK,UAAU,GAAI,EAAKA,EAAO,OAAS,GAAM,CAAC,EAE7E,OADsBE,EAAOD,CAAY,CAE3C","names":["jwtDecode","JwksClient","decode","EventEmitter","IssuerToJwkEndpoint","_KeylessAccount","Serializable","args","address","ephemeralKeyPair","uidKey","uidVal","aud","pepper","proofOrFetcher","proofFetchCallback","jwt","KeylessPublicKey","AccountAddress","EventEmitter","ZeroKnowledgeSig","status","pepperBytes","Hex","promise","error","serializer","deserializer","EphemeralKeyPair","proof","jwtHeader","jwtDecode","client","JwksClient","message","signature","AnySignature","publicKey","AnyPublicKey","AccountAuthenticatorSingleKey","transaction","data","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","KeylessSignature","base64UrlDecode","EphemeralCertificate","raw","deriveTransactionType","txnAndProof","TransactionAndProof","signMess","generateSigningMessageForSerializable","bytes","Deserializer","jwtPayload","iss","KeylessAccount","base64Url","base64","paddedBase64","decode"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as r}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)}deserializeOptionStr(){if(this.deserializeUleb128AsU32()===1)return this.deserializeStr()}deserializeOption(e){if(this.deserializeUleb128AsU32()===1)return this.deserialize(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<r;){let t=this.deserializeU8();if(e|=BigInt(t&127)<<BigInt(i),!(t&128))break;i+=7}if(e>r)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(),t=new Array;for(let s=0;s<i;s+=1)t.push(this.deserialize(e));return t}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-VT6XJSRO.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 a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserializeStr();\n }\n return undefined;\n }\n\n /**\n * Deserializes a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOption<T>(cls: Deserializable<T>): T | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserialize(cls);\n }\n return undefined;\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,CAcA,sBAA2C,CAEzC,GADe,KAAK,wBAAwB,IAC7B,EACb,OAAO,KAAK,eAAe,CAG/B,CAcA,kBAAqBC,EAAuC,CAE1D,GADe,KAAK,wBAAwB,IAC7B,EACb,OAAO,KAAK,YAAYA,CAAG,CAG/B,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,IAAIJ,EAAgB,OAAO,CAAC,EACxBM,EAAQ,EAEZ,KAAON,EAAQO,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAR,GAAS,OAAOQ,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIN,EAAQO,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAOP,CAAK,CACrB,CAeA,YAAeC,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAyBA,kBAAqBA,EAAkC,CACrD,IAAMH,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYR,CAAG,CAAC,EAEnC,OAAOQ,CACT,CACF","names":["Deserializer","data","length","bytes","value","cls","len","bool","low","high","shift","MAX_U32_NUMBER","byte","vector","i"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-RKHPXZM6.mjs";import{a as R}from"./chunk-NBEXLW7P.mjs";var c={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 l(s,i){let{url:u,method:o,body:d,contentType:p,params:t,overrides:e,originMethod:a}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":p??"application/json","x-aptos-typescript-sdk-origin-method":a};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),i.provider({url:u,method:o,body:d,params:t,headers:r,overrides:e})}async function N(s,i,u){let{url:o,path:d}=s,p=d?`${o}/${d}`:o,t=await l({...s,url:p},i.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:p};if(e.status===401)throw new n(s,e,`Error: ${e.data}`);if(u==="Indexer"){let r=e.data;if(r.errors)throw new n(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;if(e.status>=500)throw new n(s,e,`${t.data}`);if(i.isPepperServiceRequest(o)||i.isProverServiceRequest(o))throw new n(s,e,`${t.data}`);let a;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?a=JSON.stringify(e.data):e.status in c?a=c[e.status]:a=`Unhandled Error ${e.status} : ${e.statusText}`,new n(s,e,`${u} error: ${a}`)}export{l as a,N as b};
|
|
2
|
-
//# sourceMappingURL=chunk-WM2NCYZL.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var E=(S=>(S.FULLNODE="Fullnode",S.INDEXER="Indexer",S.FAUCET="Faucet",S.PEPPER="Pepper",S.PROVER="Prover",S))(E||{}),t=2e5,R=20,n=20,o="0x1::aptos_coin::AptosCoin",T="APTOS::RawTransaction",A="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{E as a,t as b,R as c,n as d,o as e,T as f,A as g,O as h};
|
|
2
|
-
//# sourceMappingURL=chunk-YE5B2S5L.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 PEPPER = \"Pepper\",\n PROVER = \"Prover\",\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,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SALCA,OAAA,IAgBCC,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{b as p}from"./chunk-WM2NCYZL.mjs";async function r(e){let{aptosConfig:t,overrides:s,params:n,contentType:o,acceptType:i,path:a,originMethod:R,type:d}=e,u=t.getRequestUrl(d);return p({url:u,method:"GET",originMethod:R,path:a,contentType:o,acceptType:i,params:n,overrides:{...t.clientConfig,...s}},t,e.type)}async function m(e){let{aptosConfig:t}=e;return r({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){return r({...e,type:"Pepper"})}async function A(e){let t=[],s,n=e.params;do{let o=await r({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:n,overrides:e.overrides});s=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),n.start=s}while(s!=null);return t}export{r as a,m as b,y as c,A as d};
|
|
2
|
-
//# sourceMappingURL=chunk-YGOJYDJA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/get.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type GetRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type GetAptosRequestOptions = Omit<GetRequestOptions, \"type\">;\n\n/**\n * Main function to do a Get request\n *\n * @param options GetRequestOptions\n * @returns\n */\nexport async function get<Req extends {}, Res extends {}>(\n options: GetRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig, overrides, params, contentType, acceptType, path, originMethod, type } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"GET\",\n originMethod,\n path,\n contentType,\n acceptType,\n params,\n overrides: {\n ...aptosConfig.clientConfig,\n ...overrides,\n },\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function getAptosFullNode<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return get<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function getAptosPepperService<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return get<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/// This function is a helper for paginating using a function wrapping an API\nexport async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<Res> {\n const out: any[] = [];\n let cursor: string | undefined;\n const requestParams = options.params as { start?: string; limit?: number };\n do {\n // eslint-disable-next-line no-await-in-loop\n const response = await get<Req, Res>({\n type: AptosApiType.FULLNODE,\n aptosConfig: options.aptosConfig,\n originMethod: options.originMethod,\n path: options.path,\n params: requestParams,\n overrides: options.overrides,\n });\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n */\n cursor = response.headers[\"x-aptos-cursor\"];\n // Now that we have the cursor (if any), we remove the headers before\n // adding these to the output of this function.\n delete response.headers;\n out.push(...response.data);\n requestParams.start = cursor;\n } while (cursor !== null && cursor !== undefined);\n return out as Res;\n}\n"],"mappings":"yCAiDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,YAAAC,EAAa,UAAAC,EAAW,OAAAC,EAAQ,YAAAC,EAAa,WAAAC,EAAY,KAAAC,EAAM,aAAAC,EAAc,KAAAC,CAAK,EAAIR,EACxFS,EAAMR,EAAY,cAAcO,CAAI,EAE1C,OAAOE,EACL,CACE,IAAAD,EACA,OAAQ,MACR,aAAAF,EACA,KAAAD,EACA,YAAAF,EACA,WAAAC,EACA,OAAAF,EACA,UAAW,CACT,GAAGF,EAAY,aACf,GAAGC,CACL,CACF,EACAD,EACAD,EAAQ,IACV,CACF,CAEA,eAAsBW,EACpBX,EACkC,CAClC,GAAM,CAAE,YAAAC,CAAY,EAAID,EAExB,OAAOD,EAAc,CACnB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGC,EAAY,aACf,GAAGA,EAAY,eACf,GAAGD,EAAQ,UACX,QAAS,CAAE,GAAGC,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAEA,eAAsBW,EACpBZ,EACkC,CAClC,OAAOD,EAAc,CAAE,GAAGC,EAAS,aAA0B,CAAC,CAChE,CAGA,eAAsBa,EACpBb,EACc,CACd,IAAMc,EAAa,CAAC,EAChBC,EACEC,EAAgBhB,EAAQ,OAC9B,EAAG,CAED,IAAMiB,EAAW,MAAMlB,EAAc,CACnC,gBACA,YAAaC,EAAQ,YACrB,aAAcA,EAAQ,aACtB,KAAMA,EAAQ,KACd,OAAQgB,EACR,UAAWhB,EAAQ,SACrB,CAAC,EAMDe,EAASE,EAAS,QAAQ,gBAAgB,EAG1C,OAAOA,EAAS,QAChBH,EAAI,KAAK,GAAGG,EAAS,IAAI,EACzBD,EAAc,MAAQD,CACxB,OAASA,GAAW,MACpB,OAAOD,CACT","names":["get","options","aptosConfig","overrides","params","contentType","acceptType","path","originMethod","type","url","aptosRequest","getAptosFullNode","getAptosPepperService","paginateWithCursor","out","cursor","requestParams","response"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-WM2NCYZL.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
|
|
2
|
-
//# sourceMappingURL=chunk-YNNPWCF6.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,c}from"./chunk-3CUVYW32.mjs";import{i as o,j as l}from"./chunk-PGCBIU33.mjs";import{a as n,c as s}from"./chunk-SI7MPP6G.mjs";import{b}from"./chunk-COW5IGYC.mjs";import{a as p}from"./chunk-STYDBDYL.mjs";import{a as y}from"./chunk-7STYQ5ZE.mjs";var f=class t extends b{constructor(e){super();if(this.publicKey=e,e instanceof n)this.variant=0;else if(e instanceof a)this.variant=1;else if(e instanceof o)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof u?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return y.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;case 3:i=o.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}},u=class t extends p{constructor(e){super();if(this.signature=e,e instanceof s)this.variant=0;else if(e instanceof c)this.variant=1;else if(e instanceof l)this.variant=3;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;case 3:i=l.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new t(i)}};export{f as a,u as b};
|
|
2
|
-
//# sourceMappingURL=chunk-YV7OBLK2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { KeylessPublicKey, KeylessSignature } from \"./keyless\";\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 if (publicKey instanceof KeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.Keyless;\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 case AnyPublicKeyVariant.Keyless:\n publicKey = KeylessPublicKey.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 if (signature instanceof KeylessSignature) {\n this.variant = AnySignatureVariant.Keyless;\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 case AnySignatureVariant.Keyless:\n signature = KeylessSignature.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":"4PAiBO,IAAMA,EAAN,MAAMC,UAAqBC,CAAiB,CAajD,YAAYC,EAAsB,CAChC,MAAM,EACN,QAAK,UAAYA,EACbA,aAAqBC,EACvB,KAAK,QAAU,UACND,aAAqBE,EAC9B,KAAK,QAAU,UACNF,aAAqBG,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,6BAA6B,CAEjD,CAMA,gBAAgBC,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAME,aAAqBC,EAIpB,KAAK,UAAU,gBAAgB,CACpC,QAAAF,EACA,UAAWC,EAAU,SACvB,CAAC,EANQ,EAOX,CAEA,SAA6B,CAC3B,OAAOE,EAAkB,mBAAmB,CAC1C,SACA,MAAO,KAAK,aAAa,CAC3B,CAAC,CACH,CAEA,cAAe,CACb,OAAO,KAAK,WAAW,CACzB,CAMA,UAAUC,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDV,EACJ,OAAQW,EAAc,CACpB,OACEX,EAAYC,EAAiB,YAAYS,CAAY,EACrD,MACF,OACEV,EAAYE,EAAmB,YAAYQ,CAAY,EACvD,MACF,OACEV,EAAYG,EAAiB,YAAYO,CAAY,EACrD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIb,EAAaE,CAAS,CACnC,CAOA,OAAO,YAAYA,EAAwD,CACzE,OAAOA,aAAqBF,CAC9B,CAKA,WAAqB,CACnB,OAAO,KAAK,qBAAqBG,CACnC,CAKA,sBAAgC,CAC9B,OAAO,KAAK,qBAAqBC,CACnC,CACF,EAOaK,EAAN,MAAMK,UAAqBC,CAAU,CAU1C,YAAYP,EAAsB,CAChC,MAAM,EACN,QAAK,UAAYA,EAEbA,aAAqBQ,EACvB,KAAK,QAAU,UACNR,aAAqBS,EAC9B,KAAK,QAAU,UACNT,aAAqBU,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,4BAA4B,CAEhD,CAMA,cAAe,CACb,OAAO,KAAK,WAAW,CACzB,CAMA,UAAUP,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,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,OACEJ,EAAYU,EAAiB,YAAYN,CAAY,EACrD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIC,EAAaN,CAAS,CACnC,CAGF","names":["AnyPublicKey","_AnyPublicKey","AccountPublicKey","publicKey","Ed25519PublicKey","Secp256k1PublicKey","KeylessPublicKey","args","message","signature","AnySignature","AuthenticationKey","serializer","deserializer","variantIndex","_AnySignature","Signature","Ed25519Signature","Secp256k1Signature","KeylessSignature"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{m as g,v as a}from"./chunk-S4SEFF4K.mjs";import{b as n}from"./chunk-YGOJYDJA.mjs";import{b as p,c}from"./chunk-YNNPWCF6.mjs";async function h(o){let{aptosConfig:t}=o,{data:e}=await n({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function l(o){let{aptosConfig:t,ledgerVersion:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:t,blockHeight:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:t,handle:e,data:s,options:r}=o;return(await p({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:t,limit:e}=o;return(await i({aptosConfig:t,query:{query:g,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function i(o){let{aptosConfig:t,query:e,originMethod:s}=o,{data:r}=await c({aptosConfig:t,originMethod:s??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:t}=o;return(await i({aptosConfig:t,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function q(o){let t=await f({aptosConfig:o.aptosConfig});return BigInt(t[0].last_success_version)}async function b(o){let{aptosConfig:t,processorType:e}=o;return(await i({aptosConfig:t,query:{query:a,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{h as a,l as b,C as c,m as d,T as e,i as f,f as g,q as h,b as i};
|
|
2
|
-
//# sourceMappingURL=chunk-ZKRG4C4U.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/general.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/general}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * general namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosFullNode, postAptosFullNode, postAptosIndexer } from \"../client\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n TableItemRequest,\n} from \"../types\";\nimport { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from \"../types/generated/operations\";\nimport { GetChainTopUserTransactions, GetProcessorStatus } from \"../types/generated/queries\";\nimport { ProcessorType } from \"../utils/const\";\n\nexport async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise<LedgerInfo> {\n const { aptosConfig } = args;\n const { data } = await getAptosFullNode<{}, LedgerInfo>({\n aptosConfig,\n originMethod: \"getLedgerInfo\",\n path: \"\",\n });\n return data;\n}\n\nexport async function getBlockByVersion(args: {\n aptosConfig: AptosConfig;\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n}): Promise<Block> {\n const { aptosConfig, ledgerVersion, options } = args;\n const { data } = await getAptosFullNode<{}, Block>({\n aptosConfig,\n originMethod: \"getBlockByVersion\",\n path: `blocks/by_version/${ledgerVersion}`,\n params: { with_transactions: options?.withTransactions },\n });\n return data;\n}\n\nexport async function getBlockByHeight(args: {\n aptosConfig: AptosConfig;\n blockHeight: AnyNumber;\n options?: { withTransactions?: boolean };\n}): Promise<Block> {\n const { aptosConfig, blockHeight, options } = args;\n const { data } = await getAptosFullNode<{}, Block>({\n aptosConfig,\n originMethod: \"getBlockByHeight\",\n path: `blocks/by_height/${blockHeight}`,\n params: { with_transactions: options?.withTransactions },\n });\n return data;\n}\n\nexport async function getTableItem<T>(args: {\n aptosConfig: AptosConfig;\n handle: string;\n data: TableItemRequest;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, handle, data, options } = args;\n const response = await postAptosFullNode<TableItemRequest, any>({\n aptosConfig,\n originMethod: \"getTableItem\",\n path: `tables/${handle}/item`,\n params: { ledger_version: options?.ledgerVersion },\n body: data,\n });\n return response.data as T;\n}\n\nexport async function getChainTopUserTransactions(args: {\n aptosConfig: AptosConfig;\n limit: number;\n}): Promise<GetChainTopUserTransactionsResponse> {\n const { aptosConfig, limit } = args;\n const graphqlQuery = {\n query: GetChainTopUserTransactions,\n variables: { limit },\n };\n\n const data = await queryIndexer<GetChainTopUserTransactionsQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getChainTopUserTransactions\",\n });\n\n return data.user_transactions;\n}\n\nexport async function queryIndexer<T extends {}>(args: {\n aptosConfig: AptosConfig;\n query: GraphqlQuery;\n originMethod?: string;\n}): Promise<T> {\n const { aptosConfig, query, originMethod } = args;\n const { data } = await postAptosIndexer<GraphqlQuery, T>({\n aptosConfig,\n originMethod: originMethod ?? \"queryIndexer\",\n path: \"\",\n body: query,\n overrides: { WITH_CREDENTIALS: false },\n });\n return data;\n}\n\nexport async function getProcessorStatuses(args: { aptosConfig: AptosConfig }): Promise<GetProcessorStatusResponse> {\n const { aptosConfig } = args;\n\n const graphqlQuery = {\n query: GetProcessorStatus,\n };\n\n const data = await queryIndexer<GetProcessorStatusQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getProcessorStatuses\",\n });\n\n return data.processor_status;\n}\n\nexport async function getIndexerLastSuccessVersion(args: { aptosConfig: AptosConfig }): Promise<bigint> {\n const response = await getProcessorStatuses({ aptosConfig: args.aptosConfig });\n return BigInt(response[0].last_success_version);\n}\n\nexport async function getProcessorStatus(args: {\n aptosConfig: AptosConfig;\n processorType: ProcessorType;\n}): Promise<GetProcessorStatusResponse[0]> {\n const { aptosConfig, processorType } = args;\n\n const whereCondition: { processor: { _eq: string } } = {\n processor: { _eq: processorType },\n };\n\n const graphqlQuery = {\n query: GetProcessorStatus,\n variables: {\n where_condition: whereCondition,\n },\n };\n\n const data = await queryIndexer<GetProcessorStatusQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getProcessorStatus\",\n });\n\n return data.processor_status[0];\n}\n"],"mappings":"oIA0BA,eAAsBA,EAAcC,EAAyD,CAC3F,GAAM,CAAE,YAAAC,CAAY,EAAID,EAClB,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAAiC,CACtD,YAAAF,EACA,aAAc,gBACd,KAAM,EACR,CAAC,EACD,OAAOC,CACT,CAEA,eAAsBE,EAAkBJ,EAIrB,CACjB,GAAM,CAAE,YAAAC,EAAa,cAAAI,EAAe,QAAAC,CAAQ,EAAIN,EAC1C,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAA4B,CACjD,YAAAF,EACA,aAAc,oBACd,KAAM,qBAAqBI,CAAa,GACxC,OAAQ,CAAE,kBAAmBC,GAAS,gBAAiB,CACzD,CAAC,EACD,OAAOJ,CACT,CAEA,eAAsBK,EAAiBP,EAIpB,CACjB,GAAM,CAAE,YAAAC,EAAa,YAAAO,EAAa,QAAAF,CAAQ,EAAIN,EACxC,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAA4B,CACjD,YAAAF,EACA,aAAc,mBACd,KAAM,oBAAoBO,CAAW,GACrC,OAAQ,CAAE,kBAAmBF,GAAS,gBAAiB,CACzD,CAAC,EACD,OAAOJ,CACT,CAEA,eAAsBO,EAAgBT,EAKvB,CACb,GAAM,CAAE,YAAAC,EAAa,OAAAS,EAAQ,KAAAR,EAAM,QAAAI,CAAQ,EAAIN,EAQ/C,OAPiB,MAAMW,EAAyC,CAC9D,YAAAV,EACA,aAAc,eACd,KAAM,UAAUS,CAAM,QACtB,OAAQ,CAAE,eAAgBJ,GAAS,aAAc,EACjD,KAAMJ,CACR,CAAC,GACe,IAClB,CAEA,eAAsBU,EAA4BZ,EAGD,CAC/C,GAAM,CAAE,YAAAC,EAAa,MAAAY,CAAM,EAAIb,EAY/B,OANa,MAAMc,EAA+C,CAChE,YAAAb,EACA,MAPmB,CACnB,MAAOc,EACP,UAAW,CAAE,MAAAF,CAAM,CACrB,EAKE,aAAc,6BAChB,CAAC,GAEW,iBACd,CAEA,eAAsBC,EAA2Bd,EAIlC,CACb,GAAM,CAAE,YAAAC,EAAa,MAAAe,EAAO,aAAAC,CAAa,EAAIjB,EACvC,CAAE,KAAAE,CAAK,EAAI,MAAMgB,EAAkC,CACvD,YAAAjB,EACA,aAAcgB,GAAgB,eAC9B,KAAM,GACN,KAAMD,EACN,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACD,OAAOd,CACT,CAEA,eAAsBiB,EAAqBnB,EAAyE,CAClH,GAAM,CAAE,YAAAC,CAAY,EAAID,EAYxB,OANa,MAAMc,EAAsC,CACvD,YAAAb,EACA,MANmB,CACnB,MAAOmB,CACT,EAKE,aAAc,sBAChB,CAAC,GAEW,gBACd,CAEA,eAAsBC,EAA6BrB,EAAqD,CACtG,IAAMsB,EAAW,MAAMH,EAAqB,CAAE,YAAanB,EAAK,WAAY,CAAC,EAC7E,OAAO,OAAOsB,EAAS,CAAC,EAAE,oBAAoB,CAChD,CAEA,eAAsBC,EAAmBvB,EAGE,CACzC,GAAM,CAAE,YAAAC,EAAa,cAAAuB,CAAc,EAAIxB,EAmBvC,OANa,MAAMc,EAAsC,CACvD,YAAAb,EACA,MATmB,CACnB,MAAOmB,EACP,UAAW,CACT,gBAPmD,CACrD,UAAW,CAAE,IAAKI,CAAc,CAClC,CAME,CACF,EAKE,aAAc,oBAChB,CAAC,GAEW,iBAAiB,CAAC,CAChC","names":["getLedgerInfo","args","aptosConfig","data","getAptosFullNode","getBlockByVersion","ledgerVersion","options","getBlockByHeight","blockHeight","getTableItem","handle","postAptosFullNode","getChainTopUserTransactions","limit","queryIndexer","GetChainTopUserTransactions","query","originMethod","postAptosIndexer","getProcessorStatuses","GetProcessorStatus","getIndexerLastSuccessVersion","response","getProcessorStatus","processorType"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Deserializer } from '../../bcs/deserializer.mjs';
|
|
2
|
-
import { Serializer } from '../../bcs/serializer.mjs';
|
|
3
|
-
import { EphemeralPublicKeyVariant, HexInput } from '../../types/index.mjs';
|
|
4
|
-
import { P as PublicKey } from '../../publicKey-lq5djCIY.mjs';
|
|
5
|
-
import { Signature } from './signature.mjs';
|
|
6
|
-
import '../../utils/apiEndpoints.mjs';
|
|
7
|
-
import '../../types/indexer.mjs';
|
|
8
|
-
import '../../types/generated/operations.mjs';
|
|
9
|
-
import '../../types/generated/types.mjs';
|
|
10
|
-
import '../hex.mjs';
|
|
11
|
-
import '../common.mjs';
|
|
12
|
-
import '../accountAddress.mjs';
|
|
13
|
-
import '../../transactions/instances/transactionArgument.mjs';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Represents ephemeral public keys for Aptos Keyless accounts.
|
|
17
|
-
*
|
|
18
|
-
* These are not public keys used as a public key on an account. They are only used ephemerally on Keyless accounts.
|
|
19
|
-
*/
|
|
20
|
-
declare class EphemeralPublicKey extends PublicKey {
|
|
21
|
-
/**
|
|
22
|
-
* The public key itself
|
|
23
|
-
*/
|
|
24
|
-
readonly publicKey: PublicKey;
|
|
25
|
-
/**
|
|
26
|
-
* An enum indicating the scheme of the ephemeral public key
|
|
27
|
-
*/
|
|
28
|
-
readonly variant: EphemeralPublicKeyVariant;
|
|
29
|
-
constructor(publicKey: PublicKey);
|
|
30
|
-
/**
|
|
31
|
-
* Get the public key in bytes (Uint8Array).
|
|
32
|
-
*
|
|
33
|
-
* @returns Uint8Array representation of the public key
|
|
34
|
-
*/
|
|
35
|
-
toUint8Array(): Uint8Array;
|
|
36
|
-
/**
|
|
37
|
-
* Verifies a signed data with a the ephemeral public key
|
|
38
|
-
*
|
|
39
|
-
* @param args.message message
|
|
40
|
-
* @param args.signature The signature that was signed by the private key of the ephemeral public key
|
|
41
|
-
* @returns true if the signature is valid
|
|
42
|
-
*/
|
|
43
|
-
verifySignature(args: {
|
|
44
|
-
message: HexInput;
|
|
45
|
-
signature: EphemeralSignature;
|
|
46
|
-
}): boolean;
|
|
47
|
-
serialize(serializer: Serializer): void;
|
|
48
|
-
static deserialize(deserializer: Deserializer): EphemeralPublicKey;
|
|
49
|
-
static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Represents ephemeral signatures used in Aptos Keyless accounts.
|
|
53
|
-
*
|
|
54
|
-
* These signatures are used inside of KeylessSignature
|
|
55
|
-
*/
|
|
56
|
-
declare class EphemeralSignature extends Signature {
|
|
57
|
-
/**
|
|
58
|
-
* The signature signed by the private key of an EphemeralKeyPair
|
|
59
|
-
*/
|
|
60
|
-
readonly signature: Signature;
|
|
61
|
-
constructor(signature: Signature);
|
|
62
|
-
/**
|
|
63
|
-
* Get the public key in bytes (Uint8Array).
|
|
64
|
-
*
|
|
65
|
-
* @returns Uint8Array representation of the public key
|
|
66
|
-
*/
|
|
67
|
-
toUint8Array(): Uint8Array;
|
|
68
|
-
static fromHex(hexInput: HexInput): EphemeralSignature;
|
|
69
|
-
serialize(serializer: Serializer): void;
|
|
70
|
-
static deserialize(deserializer: Deserializer): EphemeralSignature;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { EphemeralPublicKey, EphemeralSignature };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-25H3DXTL.mjs";import"../../chunk-SI7MPP6G.mjs";import"../../chunk-TJDC5PWD.mjs";import"../../chunk-COW5IGYC.mjs";import"../../chunk-STYDBDYL.mjs";import"../../chunk-LR65XHSF.mjs";import"../../chunk-7STYQ5ZE.mjs";import"../../chunk-T23OVRNF.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-EB7AI4B4.mjs";import"../../chunk-6RBUXB5I.mjs";import"../../chunk-C3L4ETUF.mjs";import"../../chunk-3FVRXELT.mjs";import"../../chunk-JM2B5E2I.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-VT6XJSRO.mjs";import"../../chunk-TVRJ3M7B.mjs";import"../../chunk-AOCNYMMX.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as EphemeralPublicKey,b as EphemeralSignature};
|
|
2
|
-
//# sourceMappingURL=ephemeral.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { a as AccountPublicKey, A as AuthenticationKey, P as PublicKey } from '../../publicKey-lq5djCIY.mjs';
|
|
2
|
-
import { Signature } from './signature.mjs';
|
|
3
|
-
import { Deserializer } from '../../bcs/deserializer.mjs';
|
|
4
|
-
import { Serializer, Serializable } from '../../bcs/serializer.mjs';
|
|
5
|
-
import { HexInput, EphemeralCertificateVariant, ZkpVariant } from '../../types/index.mjs';
|
|
6
|
-
import { EphemeralPublicKey, EphemeralSignature } from './ephemeral.mjs';
|
|
7
|
-
import { Proof } from './proof.mjs';
|
|
8
|
-
import '../accountAddress.mjs';
|
|
9
|
-
import '../common.mjs';
|
|
10
|
-
import '../../transactions/instances/transactionArgument.mjs';
|
|
11
|
-
import '../hex.mjs';
|
|
12
|
-
import '../../utils/apiEndpoints.mjs';
|
|
13
|
-
import '../../types/indexer.mjs';
|
|
14
|
-
import '../../types/generated/operations.mjs';
|
|
15
|
-
import '../../types/generated/types.mjs';
|
|
16
|
-
|
|
17
|
-
declare const EPK_HORIZON_SECS = 10000000;
|
|
18
|
-
declare const MAX_AUD_VAL_BYTES = 120;
|
|
19
|
-
declare const MAX_UID_KEY_BYTES = 30;
|
|
20
|
-
declare const MAX_UID_VAL_BYTES = 330;
|
|
21
|
-
declare const MAX_ISS_VAL_BYTES = 120;
|
|
22
|
-
declare const MAX_EXTRA_FIELD_BYTES = 350;
|
|
23
|
-
declare const MAX_JWT_HEADER_B64_BYTES = 300;
|
|
24
|
-
declare const MAX_COMMITED_EPK_BYTES = 93;
|
|
25
|
-
/**
|
|
26
|
-
* Represents the KeylessPublicKey public key
|
|
27
|
-
*
|
|
28
|
-
* KeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.
|
|
29
|
-
*/
|
|
30
|
-
declare class KeylessPublicKey extends AccountPublicKey {
|
|
31
|
-
static readonly ID_COMMITMENT_LENGTH: number;
|
|
32
|
-
readonly iss: string;
|
|
33
|
-
readonly idCommitment: Uint8Array;
|
|
34
|
-
constructor(iss: string, idCommitment: HexInput);
|
|
35
|
-
/**
|
|
36
|
-
* Get the authentication key for the keyless public key
|
|
37
|
-
*
|
|
38
|
-
* @returns AuthenticationKey
|
|
39
|
-
*/
|
|
40
|
-
authKey(): AuthenticationKey;
|
|
41
|
-
/**
|
|
42
|
-
* Get the public key in bytes (Uint8Array).
|
|
43
|
-
*
|
|
44
|
-
* @returns Uint8Array representation of the public key
|
|
45
|
-
*/
|
|
46
|
-
toUint8Array(): Uint8Array;
|
|
47
|
-
/**
|
|
48
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
49
|
-
*
|
|
50
|
-
* @returns string representation of the public key
|
|
51
|
-
*/
|
|
52
|
-
toString(): string;
|
|
53
|
-
/**
|
|
54
|
-
* Verifies a signed data with a public key
|
|
55
|
-
*
|
|
56
|
-
* @param args.message message
|
|
57
|
-
* @param args.signature The signature
|
|
58
|
-
* @returns true if the signature is valid
|
|
59
|
-
*/
|
|
60
|
-
verifySignature(args: {
|
|
61
|
-
message: HexInput;
|
|
62
|
-
signature: KeylessSignature;
|
|
63
|
-
}): boolean;
|
|
64
|
-
serialize(serializer: Serializer): void;
|
|
65
|
-
static deserialize(deserializer: Deserializer): KeylessPublicKey;
|
|
66
|
-
static load(deserializer: Deserializer): KeylessPublicKey;
|
|
67
|
-
static isPublicKey(publicKey: PublicKey): publicKey is KeylessPublicKey;
|
|
68
|
-
/**
|
|
69
|
-
* Creates a KeylessPublicKey from the JWT components plus pepper
|
|
70
|
-
*
|
|
71
|
-
* @param args.iss the iss of the identity
|
|
72
|
-
* @param args.uidKey the key to use to get the uidVal in the JWT token
|
|
73
|
-
* @param args.uidVal the value of the uidKey in the JWT token
|
|
74
|
-
* @param args.aud the client ID of the application
|
|
75
|
-
* @param args.pepper The pepper used to maintain privacy of the account
|
|
76
|
-
* @returns KeylessPublicKey
|
|
77
|
-
*/
|
|
78
|
-
static create(args: {
|
|
79
|
-
iss: string;
|
|
80
|
-
uidKey: string;
|
|
81
|
-
uidVal: string;
|
|
82
|
-
aud: string;
|
|
83
|
-
pepper: HexInput;
|
|
84
|
-
}): KeylessPublicKey;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* A signature of a message signed via Keyless Accounnt that uses proofs or the jwt token to authenticate.
|
|
88
|
-
*/
|
|
89
|
-
declare class KeylessSignature extends Signature {
|
|
90
|
-
/**
|
|
91
|
-
* The inner signature ZeroKnowledgeSigniature or OpenIdSignature
|
|
92
|
-
*/
|
|
93
|
-
readonly ephemeralCertificate: EphemeralCertificate;
|
|
94
|
-
/**
|
|
95
|
-
* The jwt header in the token used to create the proof/signature. In json string representation.
|
|
96
|
-
*/
|
|
97
|
-
readonly jwtHeader: string;
|
|
98
|
-
/**
|
|
99
|
-
* The expiry timestamp in seconds of the EphemeralKeyPair used to sign
|
|
100
|
-
*/
|
|
101
|
-
readonly expiryDateSecs: bigint | number;
|
|
102
|
-
/**
|
|
103
|
-
* The ephemeral public key used to verify the signature
|
|
104
|
-
*/
|
|
105
|
-
readonly ephemeralPublicKey: EphemeralPublicKey;
|
|
106
|
-
/**
|
|
107
|
-
* The signature resulting from signing with the private key of the EphemeralKeyPair
|
|
108
|
-
*/
|
|
109
|
-
readonly ephemeralSignature: EphemeralSignature;
|
|
110
|
-
constructor(args: {
|
|
111
|
-
jwtHeader: string;
|
|
112
|
-
ephemeralCertificate: EphemeralCertificate;
|
|
113
|
-
expiryDateSecs: bigint | number;
|
|
114
|
-
ephemeralPublicKey: EphemeralPublicKey;
|
|
115
|
-
ephemeralSignature: EphemeralSignature;
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* Get the signature in bytes (Uint8Array).
|
|
119
|
-
*
|
|
120
|
-
* @returns Uint8Array representation of the signature
|
|
121
|
-
*/
|
|
122
|
-
toUint8Array(): Uint8Array;
|
|
123
|
-
serialize(serializer: Serializer): void;
|
|
124
|
-
static deserialize(deserializer: Deserializer): KeylessSignature;
|
|
125
|
-
static load(deserializer: Deserializer): KeylessSignature;
|
|
126
|
-
static isSignature(signature: Signature): signature is KeylessSignature;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* A container for a signature that is a ZeroKnowledgeSig. Can be expanded to support OpenIdSignature.
|
|
130
|
-
*/
|
|
131
|
-
declare class EphemeralCertificate extends Signature {
|
|
132
|
-
readonly signature: Signature;
|
|
133
|
-
/**
|
|
134
|
-
* Index of the underlying enum variant
|
|
135
|
-
*/
|
|
136
|
-
private readonly variant;
|
|
137
|
-
constructor(signature: Signature, variant: EphemeralCertificateVariant);
|
|
138
|
-
/**
|
|
139
|
-
* Get the public key in bytes (Uint8Array).
|
|
140
|
-
*
|
|
141
|
-
* @returns Uint8Array representation of the public key
|
|
142
|
-
*/
|
|
143
|
-
toUint8Array(): Uint8Array;
|
|
144
|
-
serialize(serializer: Serializer): void;
|
|
145
|
-
static deserialize(deserializer: Deserializer): EphemeralCertificate;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* A representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof.
|
|
149
|
-
*/
|
|
150
|
-
declare class Groth16Zkp extends Proof {
|
|
151
|
-
/**
|
|
152
|
-
* The bytes of G1 proof point a
|
|
153
|
-
*/
|
|
154
|
-
a: Uint8Array;
|
|
155
|
-
/**
|
|
156
|
-
* The bytes of G2 proof point b
|
|
157
|
-
*/
|
|
158
|
-
b: Uint8Array;
|
|
159
|
-
/**
|
|
160
|
-
* The bytes of G1 proof point c
|
|
161
|
-
*/
|
|
162
|
-
c: Uint8Array;
|
|
163
|
-
constructor(args: {
|
|
164
|
-
a: HexInput;
|
|
165
|
-
b: HexInput;
|
|
166
|
-
c: HexInput;
|
|
167
|
-
});
|
|
168
|
-
serialize(serializer: Serializer): void;
|
|
169
|
-
static deserialize(deserializer: Deserializer): Groth16Zkp;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* A container for a different zero knowledge proof types
|
|
173
|
-
*/
|
|
174
|
-
declare class ZkProof extends Serializable {
|
|
175
|
-
readonly proof: Proof;
|
|
176
|
-
/**
|
|
177
|
-
* Index of the underlying enum variant
|
|
178
|
-
*/
|
|
179
|
-
private readonly variant;
|
|
180
|
-
constructor(proof: Proof, variant: ZkpVariant);
|
|
181
|
-
serialize(serializer: Serializer): void;
|
|
182
|
-
static deserialize(deserializer: Deserializer): ZkProof;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* The signature representation of a proof
|
|
186
|
-
*/
|
|
187
|
-
declare class ZeroKnowledgeSig extends Signature {
|
|
188
|
-
/**
|
|
189
|
-
* The proof
|
|
190
|
-
*/
|
|
191
|
-
readonly proof: ZkProof;
|
|
192
|
-
/**
|
|
193
|
-
* The max lifespan of the proof
|
|
194
|
-
*/
|
|
195
|
-
readonly expHorizonSecs: bigint;
|
|
196
|
-
/**
|
|
197
|
-
* A key value pair on the JWT token that can be made public
|
|
198
|
-
*/
|
|
199
|
-
readonly extraField?: string;
|
|
200
|
-
/**
|
|
201
|
-
* Set in the case of signing by recovery services
|
|
202
|
-
*/
|
|
203
|
-
readonly overrideAudVal?: string;
|
|
204
|
-
/**
|
|
205
|
-
* The training wheels signature
|
|
206
|
-
*/
|
|
207
|
-
readonly trainingWheelsSignature?: EphemeralSignature;
|
|
208
|
-
constructor(args: {
|
|
209
|
-
proof: ZkProof;
|
|
210
|
-
expHorizonSecs?: bigint;
|
|
211
|
-
extraField?: string;
|
|
212
|
-
overrideAudVal?: string;
|
|
213
|
-
trainingWheelsSignature?: EphemeralSignature;
|
|
214
|
-
});
|
|
215
|
-
/**
|
|
216
|
-
* Get the signature in bytes (Uint8Array).
|
|
217
|
-
*
|
|
218
|
-
* @returns Uint8Array representation of the signature
|
|
219
|
-
*/
|
|
220
|
-
toUint8Array(): Uint8Array;
|
|
221
|
-
/**
|
|
222
|
-
* Return a ZeroKnowledgeSig object from its bcs serialization in bytes.
|
|
223
|
-
*
|
|
224
|
-
* @returns ZeroKnowledgeSig
|
|
225
|
-
*/
|
|
226
|
-
static fromBytes(bytes: Uint8Array): ZeroKnowledgeSig;
|
|
227
|
-
serialize(serializer: Serializer): void;
|
|
228
|
-
static deserialize(deserializer: Deserializer): ZeroKnowledgeSig;
|
|
229
|
-
static load(deserializer: Deserializer): ZeroKnowledgeSig;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export { EPK_HORIZON_SECS, EphemeralCertificate, Groth16Zkp, KeylessPublicKey, KeylessSignature, MAX_AUD_VAL_BYTES, MAX_COMMITED_EPK_BYTES, MAX_EXTRA_FIELD_BYTES, MAX_ISS_VAL_BYTES, MAX_JWT_HEADER_B64_BYTES, MAX_UID_KEY_BYTES, MAX_UID_VAL_BYTES, ZeroKnowledgeSig, ZkProof };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"../../chunk-PGCBIU33.mjs";import"../../chunk-FLYEALDB.mjs";import"../../chunk-N466X3S6.mjs";import"../../chunk-25H3DXTL.mjs";import"../../chunk-SI7MPP6G.mjs";import"../../chunk-TJDC5PWD.mjs";import"../../chunk-COW5IGYC.mjs";import"../../chunk-STYDBDYL.mjs";import"../../chunk-LR65XHSF.mjs";import"../../chunk-7STYQ5ZE.mjs";import"../../chunk-T23OVRNF.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-EB7AI4B4.mjs";import"../../chunk-6RBUXB5I.mjs";import"../../chunk-C3L4ETUF.mjs";import"../../chunk-3FVRXELT.mjs";import"../../chunk-JM2B5E2I.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-VT6XJSRO.mjs";import"../../chunk-TVRJ3M7B.mjs";import"../../chunk-AOCNYMMX.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as EPK_HORIZON_SECS,k as EphemeralCertificate,l as Groth16Zkp,i as KeylessPublicKey,j as KeylessSignature,b as MAX_AUD_VAL_BYTES,h as MAX_COMMITED_EPK_BYTES,f as MAX_EXTRA_FIELD_BYTES,e as MAX_ISS_VAL_BYTES,g as MAX_JWT_HEADER_B64_BYTES,c as MAX_UID_KEY_BYTES,d as MAX_UID_VAL_BYTES,n as ZeroKnowledgeSig,m as ZkProof};
|
|
2
|
-
//# sourceMappingURL=keyless.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
declare function hashASCIIStrToField(str: string, maxSizeBytes: number): bigint;
|
|
2
|
-
declare function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[];
|
|
3
|
-
declare function bytesToBigIntLE(bytes: Uint8Array): bigint;
|
|
4
|
-
declare function bigIntToBytesLE(value: bigint, length: number): Uint8Array;
|
|
5
|
-
declare function poseidonHash(inputs: (number | bigint | string)[]): bigint;
|
|
6
|
-
|
|
7
|
-
export { bigIntToBytesLE, bytesToBigIntLE, hashASCIIStrToField, padAndPackBytesWithLen, poseidonHash };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Serializable } from '../../bcs/serializer.mjs';
|
|
2
|
-
import '../hex.mjs';
|
|
3
|
-
import '../common.mjs';
|
|
4
|
-
import '../../types/index.mjs';
|
|
5
|
-
import '../../utils/apiEndpoints.mjs';
|
|
6
|
-
import '../../types/indexer.mjs';
|
|
7
|
-
import '../../types/generated/operations.mjs';
|
|
8
|
-
import '../../types/generated/types.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An abstract representation of a crypto proof.
|
|
12
|
-
* associated to a specific zero knowledge proof schemes e.g. Groth16, PLONK
|
|
13
|
-
*/
|
|
14
|
-
declare abstract class Proof extends Serializable {
|
|
15
|
-
/**
|
|
16
|
-
* Get the proof as a hex string with a 0x prefix e.g. 0x123456...
|
|
17
|
-
*/
|
|
18
|
-
toString(): string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Proof };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"../../chunk-N466X3S6.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-EB7AI4B4.mjs";import"../../chunk-6RBUXB5I.mjs";import"../../chunk-C3L4ETUF.mjs";import"../../chunk-3FVRXELT.mjs";import"../../chunk-JM2B5E2I.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-VT6XJSRO.mjs";import"../../chunk-TVRJ3M7B.mjs";import"../../chunk-AOCNYMMX.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as Proof};
|
|
2
|
-
//# sourceMappingURL=proof.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|