@aptos-labs/ts-sdk 1.16.0-zeta.0 → 1.16.0-zeta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-BtD_TE5q.d.ts → accountAddress-OUd5ov6z.d.ts} +56 -10
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/index.d.ts +156 -32
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +4 -4
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +68 -9
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +2 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +5 -4
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +5 -4
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +15 -10
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +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 +14 -8
- 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 +40 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-272NA6H5.mjs} +1 -1
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-272NA6H5.mjs.map} +1 -1
- package/dist/esm/{chunk-OT37OTT7.mjs → chunk-34WI7I3Z.mjs} +2 -2
- package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-3DP4R3FI.mjs} +2 -2
- package/dist/esm/{chunk-IJE5YSXW.mjs → chunk-3J53BCEQ.mjs} +2 -2
- package/dist/esm/{chunk-NWWXZ7EW.mjs → chunk-3SXTTG2X.mjs} +2 -2
- package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-3YIUOKWW.mjs} +2 -2
- package/dist/esm/{chunk-REBMGDZ5.mjs → chunk-45ESRYGP.mjs} +2 -2
- package/dist/esm/{chunk-5V2RGYYK.mjs → chunk-4RXGVY2H.mjs} +2 -2
- package/dist/esm/{chunk-MWUJCP27.mjs → chunk-4VAYXBD2.mjs} +2 -2
- package/dist/esm/{chunk-6KNAIXZ3.mjs → chunk-5SGIYAB7.mjs} +2 -2
- package/dist/esm/chunk-5VLCYHNJ.mjs +2 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs.map +1 -0
- package/dist/esm/{chunk-Q3AUNZDW.mjs → chunk-6F3HFDL3.mjs} +2 -2
- package/dist/esm/{chunk-FBLSW5TB.mjs → chunk-6MDYCC7P.mjs} +2 -2
- package/dist/esm/{chunk-M7HZOQ6A.mjs → chunk-7CJAEAQZ.mjs} +2 -2
- package/dist/esm/{chunk-Y33VGXNI.mjs → chunk-7Y6AWDBZ.mjs} +2 -2
- package/dist/esm/{chunk-COW5IGYC.mjs → chunk-AUAL3H36.mjs} +2 -2
- package/dist/esm/{chunk-6M53MDWB.mjs → chunk-AUV4VAXK.mjs} +2 -2
- package/dist/esm/{chunk-MTLETLKV.mjs → chunk-AVWAYKNS.mjs} +2 -2
- package/dist/esm/{chunk-EIRSA5UU.mjs → chunk-BNA3SGG6.mjs} +2 -2
- package/dist/esm/{chunk-Y5BON557.mjs → chunk-CEGCSC3T.mjs} +2 -2
- package/dist/esm/chunk-CIPPNT3W.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs.map +1 -0
- package/dist/esm/{chunk-UFJGYMEB.mjs → chunk-CZOUSIAD.mjs} +2 -2
- package/dist/esm/chunk-D76FE35G.mjs +2 -0
- package/dist/esm/chunk-D76FE35G.mjs.map +1 -0
- package/dist/esm/{chunk-SBQRBBRS.mjs → chunk-DSVNXD5A.mjs} +2 -2
- package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-EJ7ODMDA.mjs} +2 -2
- package/dist/esm/{chunk-ONIYM7IU.mjs → chunk-EJURLI4L.mjs} +2 -2
- package/dist/esm/chunk-FUQDDIKQ.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs.map +1 -0
- package/dist/esm/chunk-FWTJQHJR.mjs +2 -0
- package/dist/esm/chunk-FWTJQHJR.mjs.map +1 -0
- package/dist/esm/{chunk-W637YAND.mjs → chunk-GHHIUWPP.mjs} +2 -2
- package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-GS5Z3HO7.mjs} +2 -2
- package/dist/esm/{chunk-4USAUOCE.mjs → chunk-HGRU3HWY.mjs} +2 -2
- package/dist/esm/{chunk-TEJ7BXJK.mjs → chunk-HOX6Q6ZP.mjs} +2 -2
- package/dist/esm/chunk-HQK6MF3G.mjs +2 -0
- package/dist/esm/chunk-IMVC2JKU.mjs +2 -0
- package/dist/esm/{chunk-N7CE244N.mjs.map → chunk-IMVC2JKU.mjs.map} +1 -1
- package/dist/esm/{chunk-RUSWW265.mjs → chunk-ISXBJPLD.mjs} +2 -2
- package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-IU6REVKX.mjs} +2 -2
- package/dist/esm/{chunk-Z6JERVLX.mjs → chunk-IWKIZLFW.mjs} +2 -2
- package/dist/esm/{chunk-LQH7T3TE.mjs → chunk-J534ICWA.mjs} +2 -2
- package/dist/esm/{chunk-STYDBDYL.mjs → chunk-J577ODDM.mjs} +2 -2
- package/dist/esm/chunk-JBTLE33X.mjs +2 -0
- package/dist/esm/{chunk-JKZHPY24.mjs.map → chunk-JBTLE33X.mjs.map} +1 -1
- package/dist/esm/{chunk-EPTCPBVW.mjs → chunk-LLRWILVZ.mjs} +2 -2
- package/dist/esm/{chunk-I5JWDZIP.mjs → chunk-M4Q4XDVR.mjs} +2 -2
- package/dist/esm/chunk-M4Q4XDVR.mjs.map +1 -0
- package/dist/esm/chunk-MEOBWD6V.mjs +2 -0
- package/dist/esm/chunk-MEOBWD6V.mjs.map +1 -0
- package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-MLQT5I6K.mjs} +2 -2
- package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-MSGHGK52.mjs} +2 -2
- package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-NGTNMV6Q.mjs} +2 -2
- package/dist/esm/{chunk-OX5GWFHX.mjs → chunk-NH466YFP.mjs} +2 -2
- package/dist/esm/{chunk-ZCCYHFPK.mjs → chunk-NMD45OTM.mjs} +2 -2
- package/dist/esm/{chunk-UWI5D7FD.mjs → chunk-NUBYALZP.mjs} +2 -2
- package/dist/esm/{chunk-KKP4FBWZ.mjs → chunk-OFC75EWS.mjs} +2 -2
- package/dist/esm/{chunk-T6OEZ4KP.mjs → chunk-OOYRJQPD.mjs} +2 -2
- package/dist/esm/chunk-OZ3GSAFK.mjs +2 -0
- package/dist/esm/chunk-OZ3GSAFK.mjs.map +1 -0
- package/dist/esm/{chunk-EU6CX56Q.mjs → chunk-PENBUSGL.mjs} +2 -2
- package/dist/esm/{chunk-A3UVZHDJ.mjs → chunk-PG7KSUMN.mjs} +2 -2
- package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-PGP2XMDE.mjs} +2 -2
- package/dist/esm/{chunk-JM2B5E2I.mjs → chunk-Q6LFIZ3L.mjs} +1 -1
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-EADBYPUD.mjs → chunk-QJIMZI32.mjs} +2 -2
- package/dist/esm/{chunk-YHO2EBXH.mjs → chunk-QLE5JL4X.mjs} +2 -2
- package/dist/esm/{chunk-KFUOOBMJ.mjs → chunk-QOOHLRRJ.mjs} +2 -2
- package/dist/esm/{chunk-UO5LUYGO.mjs → chunk-QYEJOEWB.mjs} +2 -2
- package/dist/esm/{chunk-NQMF46E5.mjs → chunk-R4HLV32L.mjs} +2 -2
- package/dist/esm/chunk-RAHMGSBW.mjs +2 -0
- package/dist/esm/{chunk-CNH2RAJQ.mjs.map → chunk-RAHMGSBW.mjs.map} +1 -1
- package/dist/esm/{chunk-C34M4T77.mjs → chunk-RWYPGTNL.mjs} +2 -2
- package/dist/esm/{chunk-3FVRXELT.mjs → chunk-SCHMTP4N.mjs} +2 -2
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-3Y6JNFPD.mjs → chunk-SCRIQQV3.mjs} +2 -2
- package/dist/esm/{chunk-W36IQO5K.mjs → chunk-SNBE5YAC.mjs} +2 -2
- package/dist/esm/{chunk-NCDP26DV.mjs → chunk-SSDWEOF7.mjs} +2 -2
- package/dist/esm/{chunk-N466X3S6.mjs → chunk-SZ6KR73C.mjs} +2 -2
- package/dist/esm/{chunk-F5C4SZZ7.mjs → chunk-THURV6CN.mjs} +2 -2
- package/dist/esm/{chunk-5RRZMXND.mjs → chunk-TU6VKYDC.mjs} +2 -2
- package/dist/esm/{chunk-UDU5L4XH.mjs → chunk-UFMIMN7W.mjs} +2 -2
- package/dist/esm/{chunk-LO7B3CWN.mjs → chunk-ULW5LX5H.mjs} +2 -2
- package/dist/esm/{chunk-4KEEUDZA.mjs → chunk-V6M7FGQT.mjs} +2 -2
- package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-VBODXPT3.mjs} +2 -2
- package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-VMVSUH2K.mjs} +2 -2
- package/dist/esm/{chunk-T23OVRNF.mjs → chunk-WHSN42R2.mjs} +2 -2
- package/dist/esm/{chunk-LEBJNW6Y.mjs → chunk-WJIICWOB.mjs} +2 -2
- package/dist/esm/{chunk-PYUU4OEL.mjs → chunk-WOLLRMXR.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs → chunk-WSVJNBSJ.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs.map → chunk-WSVJNBSJ.mjs.map} +1 -1
- package/dist/esm/{chunk-VT6XJSRO.mjs → chunk-WXLSJF4A.mjs} +1 -1
- package/dist/esm/chunk-WXLSJF4A.mjs.map +1 -0
- package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-XQ7I34AL.mjs} +2 -2
- package/dist/esm/{chunk-MWN63XBE.mjs → chunk-Y24BMR2W.mjs} +2 -2
- package/dist/esm/{chunk-WAXCU6D6.mjs → chunk-YLQJBXUF.mjs} +2 -2
- package/dist/esm/chunk-ZAXWW7VW.mjs +2 -0
- package/dist/esm/chunk-ZAXWW7VW.mjs.map +1 -0
- package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-ZV5P2GSJ.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +6 -0
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +6 -0
- package/dist/esm/client/post.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.mjs +1 -1
- package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +52 -8
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +14 -2
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +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.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +5 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +10 -8
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -2
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.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.mjs +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.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -11
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/types/index.d.mts +2 -2
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +37 -1
- package/dist/esm/utils/apiEndpoints.mjs +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 +1 -1
- package/src/account/EphemeralKeyPair.ts +6 -6
- package/src/account/KeylessAccount.ts +68 -30
- package/src/api/keyless.ts +15 -4
- package/src/bcs/deserializer.ts +15 -9
- package/src/bcs/serializer.ts +40 -0
- package/src/client/core.ts +4 -7
- package/src/client/get.ts +6 -0
- package/src/client/post.ts +6 -0
- package/src/core/crypto/cryptoHasher.ts +16 -0
- package/src/core/crypto/keyless.ts +159 -23
- package/src/core/crypto/poseidon.ts +17 -8
- package/src/internal/keyless.ts +81 -15
- package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
- package/src/transactions/transactionBuilder/transactionBuilder.ts +4 -2
- package/src/types/index.ts +2 -2
- package/src/types/keyless.ts +36 -0
- package/src/utils/apiEndpoints.ts +4 -2
- package/src/version.ts +1 -1
- package/dist/esm/bcs/cryptoHasher.d.mts +0 -15
- package/dist/esm/bcs/cryptoHasher.mjs +0 -2
- package/dist/esm/chunk-5ADNWXP2.mjs +0 -2
- package/dist/esm/chunk-5ADNWXP2.mjs.map +0 -1
- package/dist/esm/chunk-5YI2GEG5.mjs +0 -2
- package/dist/esm/chunk-5YI2GEG5.mjs.map +0 -1
- package/dist/esm/chunk-CNH2RAJQ.mjs +0 -2
- package/dist/esm/chunk-I5JWDZIP.mjs.map +0 -1
- package/dist/esm/chunk-JKZHPY24.mjs +0 -2
- package/dist/esm/chunk-JM2B5E2I.mjs.map +0 -1
- package/dist/esm/chunk-KPZDC5ZE.mjs +0 -2
- package/dist/esm/chunk-KPZDC5ZE.mjs.map +0 -1
- package/dist/esm/chunk-LECNIPW7.mjs +0 -2
- package/dist/esm/chunk-LECNIPW7.mjs.map +0 -1
- package/dist/esm/chunk-N7CE244N.mjs +0 -2
- package/dist/esm/chunk-R2P2XANA.mjs +0 -2
- package/dist/esm/chunk-R2P2XANA.mjs.map +0 -1
- package/dist/esm/chunk-UTXJOB3O.mjs +0 -2
- package/dist/esm/chunk-VT6XJSRO.mjs.map +0 -1
- package/dist/esm/chunk-W4IWORPF.mjs +0 -2
- package/dist/esm/chunk-W4IWORPF.mjs.map +0 -1
- package/dist/esm/chunk-WDE54GRQ.mjs +0 -2
- package/dist/esm/chunk-WDE54GRQ.mjs.map +0 -1
- package/dist/esm/chunk-YZPQVZ7S.mjs +0 -2
- package/dist/esm/chunk-YZPQVZ7S.mjs.map +0 -1
- package/dist/esm/chunk-ZUQJLFR2.mjs +0 -2
- package/dist/esm/chunk-ZUQJLFR2.mjs.map +0 -1
- package/src/bcs/cryptoHasher.ts +0 -6
- /package/dist/esm/{chunk-OT37OTT7.mjs.map → chunk-34WI7I3Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-3DP4R3FI.mjs.map} +0 -0
- /package/dist/esm/{chunk-IJE5YSXW.mjs.map → chunk-3J53BCEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWWXZ7EW.mjs.map → chunk-3SXTTG2X.mjs.map} +0 -0
- /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-3YIUOKWW.mjs.map} +0 -0
- /package/dist/esm/{chunk-REBMGDZ5.mjs.map → chunk-45ESRYGP.mjs.map} +0 -0
- /package/dist/esm/{chunk-5V2RGYYK.mjs.map → chunk-4RXGVY2H.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-4VAYXBD2.mjs.map} +0 -0
- /package/dist/esm/{chunk-6KNAIXZ3.mjs.map → chunk-5SGIYAB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3AUNZDW.mjs.map → chunk-6F3HFDL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBLSW5TB.mjs.map → chunk-6MDYCC7P.mjs.map} +0 -0
- /package/dist/esm/{chunk-M7HZOQ6A.mjs.map → chunk-7CJAEAQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y33VGXNI.mjs.map → chunk-7Y6AWDBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-AUAL3H36.mjs.map} +0 -0
- /package/dist/esm/{chunk-6M53MDWB.mjs.map → chunk-AUV4VAXK.mjs.map} +0 -0
- /package/dist/esm/{chunk-MTLETLKV.mjs.map → chunk-AVWAYKNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EIRSA5UU.mjs.map → chunk-BNA3SGG6.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5BON557.mjs.map → chunk-CEGCSC3T.mjs.map} +0 -0
- /package/dist/esm/{chunk-UFJGYMEB.mjs.map → chunk-CZOUSIAD.mjs.map} +0 -0
- /package/dist/esm/{chunk-SBQRBBRS.mjs.map → chunk-DSVNXD5A.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-EJ7ODMDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONIYM7IU.mjs.map → chunk-EJURLI4L.mjs.map} +0 -0
- /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-GHHIUWPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-GS5Z3HO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-4USAUOCE.mjs.map → chunk-HGRU3HWY.mjs.map} +0 -0
- /package/dist/esm/{chunk-TEJ7BXJK.mjs.map → chunk-HOX6Q6ZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-HQK6MF3G.mjs.map} +0 -0
- /package/dist/esm/{chunk-RUSWW265.mjs.map → chunk-ISXBJPLD.mjs.map} +0 -0
- /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-IU6REVKX.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z6JERVLX.mjs.map → chunk-IWKIZLFW.mjs.map} +0 -0
- /package/dist/esm/{chunk-LQH7T3TE.mjs.map → chunk-J534ICWA.mjs.map} +0 -0
- /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-J577ODDM.mjs.map} +0 -0
- /package/dist/esm/{chunk-EPTCPBVW.mjs.map → chunk-LLRWILVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-MLQT5I6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-MSGHGK52.mjs.map} +0 -0
- /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-NGTNMV6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-OX5GWFHX.mjs.map → chunk-NH466YFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZCCYHFPK.mjs.map → chunk-NMD45OTM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWI5D7FD.mjs.map → chunk-NUBYALZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-KKP4FBWZ.mjs.map → chunk-OFC75EWS.mjs.map} +0 -0
- /package/dist/esm/{chunk-T6OEZ4KP.mjs.map → chunk-OOYRJQPD.mjs.map} +0 -0
- /package/dist/esm/{chunk-EU6CX56Q.mjs.map → chunk-PENBUSGL.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3UVZHDJ.mjs.map → chunk-PG7KSUMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-PGP2XMDE.mjs.map} +0 -0
- /package/dist/esm/{chunk-EADBYPUD.mjs.map → chunk-QJIMZI32.mjs.map} +0 -0
- /package/dist/esm/{chunk-YHO2EBXH.mjs.map → chunk-QLE5JL4X.mjs.map} +0 -0
- /package/dist/esm/{chunk-KFUOOBMJ.mjs.map → chunk-QOOHLRRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO5LUYGO.mjs.map → chunk-QYEJOEWB.mjs.map} +0 -0
- /package/dist/esm/{chunk-NQMF46E5.mjs.map → chunk-R4HLV32L.mjs.map} +0 -0
- /package/dist/esm/{chunk-C34M4T77.mjs.map → chunk-RWYPGTNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-SCHMTP4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-3Y6JNFPD.mjs.map → chunk-SCRIQQV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-W36IQO5K.mjs.map → chunk-SNBE5YAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-NCDP26DV.mjs.map → chunk-SSDWEOF7.mjs.map} +0 -0
- /package/dist/esm/{chunk-N466X3S6.mjs.map → chunk-SZ6KR73C.mjs.map} +0 -0
- /package/dist/esm/{chunk-F5C4SZZ7.mjs.map → chunk-THURV6CN.mjs.map} +0 -0
- /package/dist/esm/{chunk-5RRZMXND.mjs.map → chunk-TU6VKYDC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UDU5L4XH.mjs.map → chunk-UFMIMN7W.mjs.map} +0 -0
- /package/dist/esm/{chunk-LO7B3CWN.mjs.map → chunk-ULW5LX5H.mjs.map} +0 -0
- /package/dist/esm/{chunk-4KEEUDZA.mjs.map → chunk-V6M7FGQT.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-VBODXPT3.mjs.map} +0 -0
- /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-VMVSUH2K.mjs.map} +0 -0
- /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-WHSN42R2.mjs.map} +0 -0
- /package/dist/esm/{chunk-LEBJNW6Y.mjs.map → chunk-WJIICWOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYUU4OEL.mjs.map → chunk-WOLLRMXR.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-XQ7I34AL.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWN63XBE.mjs.map → chunk-Y24BMR2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-WAXCU6D6.mjs.map → chunk-YLQJBXUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-ZV5P2GSJ.mjs.map} +0 -0
- /package/dist/esm/{bcs → core/crypto}/cryptoHasher.mjs.map +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t,c as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t,c as n}from"./chunk-WOLLRMXR.mjs";import{a as l}from"./chunk-AUAL3H36.mjs";import{a as u}from"./chunk-J577ODDM.mjs";import{a as s}from"./chunk-WXLSJF4A.mjs";import{b as o}from"./chunk-AOCNYMMX.mjs";var c=class i extends l{constructor(e){super();let r=e.constructor.name;switch(r){case t.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:a}=e;return this.publicKey.verifySignature({message:r,signature:a})}serialize(e){if(this.publicKey instanceof t)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(t.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof i}},p=class i extends u{constructor(e){super();let r=e.constructor.name;switch(r){case n.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=o.fromHexInput(e),a=new s(r.toUint8Array());return i.deserialize(a)}serialize(e){if(this.signature instanceof n)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(n.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};export{c as a,p as b};
|
|
2
|
+
//# sourceMappingURL=chunk-3SXTTG2X.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as f}from"./chunk-WHSN42R2.mjs";import{a as r}from"./chunk-SCHMTP4N.mjs";import{a as m,b as a,c as g}from"./chunk-GS5Z3HO7.mjs";import{a as i,b as o,c as u,d as s,e as c,f as p,g as y}from"./chunk-ZV5P2GSJ.mjs";function M(n){return typeof n=="boolean"}function D(n){return typeof n=="string"}function N(n){return typeof n=="number"}function P(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function w(n){return n==null}function G(n){return A(n)||x(n)||S(n)||B(n)||U(n)||I(n)||b(n)||T(n)||E(n)||d(n)||n instanceof m||n instanceof g}function A(n){return n instanceof i}function T(n){return n instanceof f}function E(n){return n instanceof a}function d(n){return n instanceof r}function x(n){return n instanceof o}function S(n){return n instanceof u}function B(n){return n instanceof s}function U(n){return n instanceof c}function I(n){return n instanceof p}function b(n){return n instanceof y}function $(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],l=t[2];return{moduleAddress:e,moduleName:F,functionName:l}}export{M as a,D as b,N as c,P as d,w as e,G as f,A as g,T as h,E as i,d as j,x as k,S as l,B as m,U as n,I as o,b as p,$ as q,R as r,W as s,L as t};
|
|
2
|
+
//# sourceMappingURL=chunk-3YIUOKWW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-AUV4VAXK.mjs";import{h as t}from"./chunk-BNA3SGG6.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-45ESRYGP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g,f as d,g as b,i as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g,f as d,g as b,i as S}from"./chunk-RAHMGSBW.mjs";import{a as C}from"./chunk-3J53BCEQ.mjs";import{b as f}from"./chunk-WSVJNBSJ.mjs";import{a as P}from"./chunk-PG7KSUMN.mjs";import{a as w}from"./chunk-SSDWEOF7.mjs";import{d as I}from"./chunk-MEOBWD6V.mjs";import{c as l}from"./chunk-OZ3GSAFK.mjs";import{c as y,m as s}from"./chunk-VBODXPT3.mjs";import{a as T}from"./chunk-XQ7I34AL.mjs";import{b as p}from"./chunk-WHSN42R2.mjs";import{a as r}from"./chunk-GS5Z3HO7.mjs";import{b as A}from"./chunk-ZV5P2GSJ.mjs";async function h(t){let a=await K(t);return D(t,a)}async function K(t){let{aptosConfig:a,data:n}=t,e,o;return"bytecode"in n?o=await g(n):"multisigAddress"in n?(e={aptosConfig:a,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)):(e={aptosConfig:a,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments,abi:n.abi},o=await g(e)),o}async function D(t,a){let{aptosConfig:n,sender:e,options:o}=t,i;if(G(t)&&(i=p.ZERO.toString()),U(t)){let{secondarySignerAddresses:c}=t;return d({aptosConfig:n,sender:e,payload:a,options:o,secondarySignerAddresses:c,feePayerAddress:i})}return d({aptosConfig:n,sender:e,payload:a,options:o,feePayerAddress:i})}function G(t){return t.withFeePayer===!0}function U(t){return"secondarySignerAddresses"in t}function nn(t){let{transaction:a}=t;return l(a)}function _(t){let{signer:a,transaction:n}=t;return a.signTransactionWithAuthenticator(n)}async function tn(t){let{aptosConfig:a,transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}=t,u=b({transaction:n,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}),{data:m}=await f({aptosConfig:a,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:t.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:t.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:t.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return m}async function B(t){let{aptosConfig:a}=t,n=S({...t}),{data:e}=await f({aptosConfig:a,body:n,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return e}async function M(t){let{aptosConfig:a,signer:n,transaction:e}=t;(n instanceof I||n instanceof w)&&await n.waitForProofFetch();let o=_({signer:n,transaction:e});return B({aptosConfig:a,transaction:e,senderAuthenticator:o})}var N={typeParameters:[],parameters:[s.u8(),new s(s.u8())]};async function an(t){let{aptosConfig:a,account:n,metadataBytes:e,moduleBytecode:o,options:i}=t,c=o.map(u=>r.U8(u));return h({aptosConfig:a,sender:p.from(n),data:{function:"0x1::code::publish_package_txn",functionArguments:[r.U8(e),new r(c)],abi:N},options:i})}var F={typeParameters:[],parameters:[new y,s.u8(),new y,s.u8(),s.u8(),s.u8()]};async function en(t){let{aptosConfig:a,fromAccount:n,toNewPrivateKey:e}=t,o=await C({aptosConfig:a,accountAddress:n.accountAddress}),i=P.fromPrivateKey({privateKey:e,legacy:!0}),u=new T({sequenceNumber:BigInt(o.sequence_number),originator:n.accountAddress,currentAuthKey:p.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),m=n.sign(u),R=i.sign(u),x=await h({aptosConfig:a,sender:n.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new A(n.signingScheme),r.U8(n.publicKey.toUint8Array()),new A(i.signingScheme),r.U8(i.publicKey.toUint8Array()),r.U8(m.toUint8Array()),r.U8(R.toUint8Array())],abi:F}});return M({aptosConfig:a,signer:n,transaction:x})}export{h as a,K as b,D as c,nn as d,_ as e,tn as f,B as g,M as h,an as i,en as j};
|
|
2
|
+
//# sourceMappingURL=chunk-4RXGVY2H.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-272NA6H5.mjs";var r=class a extends i{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4VAYXBD2.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x,b as f,c as l,d as U,e as M,f as C,g as O,h as B,i as _,k as V,l as G,m as j,n as k,o as z,p as D,r as i,s as L}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as A}from"./chunk-PENBUSGL.mjs";import{a as x,b as f,c as l,d as U,e as M,f as C,g as O,h as B,i as _,k as V,l as G,m as j,n as k,o as z,p as D,r as i,s as L}from"./chunk-3YIUOKWW.mjs";import{c as I}from"./chunk-3J53BCEQ.mjs";import{n as S}from"./chunk-VBODXPT3.mjs";import{b as E}from"./chunk-WHSN42R2.mjs";import{a as c,b as F,c as T}from"./chunk-GS5Z3HO7.mjs";import{a as w,b as g,c as h,d,e as p,f as v,g as $}from"./chunk-ZV5P2GSJ.mjs";var R=new TextEncoder;function Y(n){return n?.map(e=>f(e)?A(e):e)??[]}async function P(n,e,t,u){let r=await I({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(o=>o.name===t)}async function Z(n,e,t,u){let r=await P(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=L(r),y=[];for(let s=o;s<r.params.length;s+=1)y.push(A(r.params[s],{allowGenerics:!0}));return{signers:o,typeParameters:r.generic_type_params,parameters:y}}async function a(n,e,t,u){let r=await P(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let s=0;s<r.params.length;s+=1)o.push(A(r.params[s],{allowGenerics:!0}));let y=[];for(let s=0;s<r.return.length;s+=1)y.push(A(r.return[s],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:o,returnTypes:y}}function nn(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[u];return m(t,o,u,r)}function m(n,e,t,u){return C(n)?(b(e,n,t),n):X(n,e,t,u)}function X(n,e,t,u){if(e.isBool()){if(x(n))return new w(n);if(f(n)){if(n==="true")return new w(!0);if(n==="false")return new w(!1)}i("boolean",t)}if(e.isAddress()){if(f(n))return E.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){if(l(n))return new g(n);if(f(n))return new g(Number.parseInt(n,10));i("number",t)}if(e.isU16()){if(l(n))return new h(n);if(f(n))return new h(Number.parseInt(n,10));i("number",t)}if(e.isU32()){if(l(n))return new d(n);if(f(n))return new d(Number.parseInt(n,10));i("number",t)}if(e.isU64()){if(U(n))return new p(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(U(n))return new v(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(U(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return m(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(f(n))return c.U8(R.encode(n));if(n instanceof Uint8Array)return c.U8(n);if(n instanceof ArrayBuffer)return c.U8(new Uint8Array(n))}if(Array.isArray(n))return new c(n.map(r=>m(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(f(n))return new F(n);i("string",t)}if(e.isObject()){if(f(n))return E.fromString(n);i("string | AccountAddress",t)}if(e.isOption())return M(n)?new T(null):new T(m(n,e.value.typeArgs[0],t,u));throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function b(n,e,t){if(n.isBool()){if(O(e))return;i("Bool",t)}if(n.isAddress()){if(B(e))return;i("AccountAddress",t)}if(n.isU8()){if(V(e))return;i("U8",t)}if(n.isU16()){if(G(e))return;i("U16",t)}if(n.isU32()){if(j(e))return;i("U32",t)}if(n.isU64()){if(k(e))return;i("U64",t)}if(n.isU128()){if(z(e))return;i("U128",t)}if(n.isU256()){if(D(e))return;i("U256",t)}if(n.isVector()){if(e instanceof c){e.values.length>0&&b(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof S){if(n.isString()){if(_(e))return;i("MoveString",t)}if(n.isObject()){if(B(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof T){e.value!==void 0&&b(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{Y as a,P as b,Z as c,a as d,nn as e,m as f};
|
|
2
|
+
//# sourceMappingURL=chunk-5SGIYAB7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/cryptoHasher.ts"],"sourcesContent":["import { generateSigningMessage } from \"../../transactions/transactionBuilder/signingMessage\";\nimport { Serializable } from \"../../bcs/serializer\";\n\nexport type AptsoDomainSeparator = `APTOS::${string}`;\nexport abstract class CryptoHashable extends Serializable {\n abstract readonly domainSeparator: AptsoDomainSeparator;\n\n /**\n * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.\n * \n * @returns Uint8Array\n */\n hash(): Uint8Array {\n return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);\n }\n}\n"],"mappings":"kFAIO,IAAeA,EAAf,cAAsCC,CAAa,CAQxD,MAAmB,CACjB,OAAOC,EAAuB,KAAK,WAAW,EAAG,KAAK,eAAe,CACvE,CACF","names":["CryptoHashable","Serializable","generateSigningMessage"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as a}from"./chunk-6MDYCC7P.mjs";import e from"eventemitter3";var i=class extends e{constructor(t){super();this.config=t}start(t){let{sender:n}=t;this.account=n,this.transactionWorker=new a(this.config,n),this.transactionWorker.start(),this.registerToEvents()}push(t){let{data:n,options:o}=t;for(let r of n)this.transactionWorker.push(r,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async t=>{this.emit("transactionSent",t)}),this.transactionWorker.on("transactionSendFailed",async t=>{this.emit("transactionSendFailed",t)}),this.transactionWorker.on("transactionExecuted",async t=>{this.emit("transactionExecuted",t)}),this.transactionWorker.on("transactionExecutionFailed",async t=>{this.emit("transactionExecutionFailed",t)}),this.transactionWorker.on("executionFinish",async t=>{this.emit("executionFinish",t)})}forSingleAccount(t){try{let{sender:n,data:o,options:r}=t;this.start({sender:n}),this.push({data:o,options:r})}catch(n){throw new Error(`failed to submit transactions with error: ${n}`)}}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6F3HFDL3.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-IWKIZLFW.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,h as d}from"./chunk-4RXGVY2H.mjs";import{g as u}from"./chunk-BNA3SGG6.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
|
|
2
|
+
//# sourceMappingURL=chunk-6MDYCC7P.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-THURV6CN.mjs";import{a as e,b as s,c as r,d as n,e as t,g as i,h as a}from"./chunk-7Y6AWDBZ.mjs";var g=class{constructor(o){this.config=o}async getLedgerInfo(){return e({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(o){return s({aptosConfig:this.config,...o})}async getBlockByHeight(o){return r({aptosConfig:this.config,...o})}async view(o){return c({aptosConfig:this.config,...o})}async getChainTopUserTransactions(o){return n({aptosConfig:this.config,...o})}async queryIndexer(o){return t({aptosConfig:this.config,...o})}async getIndexerLastSuccessVersion(){return i({aptosConfig:this.config})}async getProcessorStatus(o){return a({aptosConfig:this.config,processorType:o})}};export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7CJAEAQZ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m as p,v as a}from"./chunk-S3EDNXZE.mjs";import{b as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{m as p,v as a}from"./chunk-S3EDNXZE.mjs";import{b as n}from"./chunk-M4Q4XDVR.mjs";import{c}from"./chunk-WSVJNBSJ.mjs";async function h(o){let{aptosConfig:t}=o,{data:s}=await n({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return s}async function d(o){let{aptosConfig:t,ledgerVersion:s,options:e}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${s}`,params:{with_transactions:e?.withTransactions}});return r}async function C(o){let{aptosConfig:t,blockHeight:s,options:e}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${s}`,params:{with_transactions:e?.withTransactions}});return r}async function l(o){let{aptosConfig:t,limit:s}=o;return(await i({aptosConfig:t,query:{query:p,variables:{limit:s}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function i(o){let{aptosConfig:t,query:s,originMethod:e}=o,{data:r}=await c({aptosConfig:t,originMethod:e??"queryIndexer",path:"",body:s,overrides:{WITH_CREDENTIALS:!1}});return r}async function g(o){let{aptosConfig:t}=o;return(await i({aptosConfig:t,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function m(o){let t=await g({aptosConfig:o.aptosConfig});return BigInt(t[0].last_success_version)}async function T(o){let{aptosConfig:t,processorType:s}=o;return(await i({aptosConfig:t,query:{query:a,variables:{where_condition:{processor:{_eq:s}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{h as a,d as b,C as c,l as d,i as e,g as f,m as g,T as h};
|
|
2
|
+
//# sourceMappingURL=chunk-7Y6AWDBZ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as e}from"./chunk-272NA6H5.mjs";import{b as r}from"./chunk-AOCNYMMX.mjs";var t=class extends e{toString(){let n=this.toUint8Array();return r.fromHexInput(n).toString()}},a=class extends t{};export{t as a,a as b};
|
|
2
|
+
//# sourceMappingURL=chunk-AUAL3H36.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as e}from"./chunk-BNA3SGG6.mjs";import{d as c}from"./chunk-WSVJNBSJ.mjs";import{d as r}from"./chunk-YE5B2S5L.mjs";import{b as s}from"./chunk-WHSN42R2.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||20,{data:d}=await c({aptosConfig:t,path:"fund",body:{address:s.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AUV4VAXK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-AUAL3H36.mjs";import{a as v}from"./chunk-J577ODDM.mjs";import{a as u}from"./chunk-TJDC5PWD.mjs";import{e as h,j as f}from"./chunk-LR65XHSF.mjs";import{a as g}from"./chunk-272NA6H5.mjs";import{b as s}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as A}from"@noble/hashes/sha3";import{secp256k1 as o}from"@noble/curves/secp256k1";import{HDKey as U}from"@scure/bip32";var n=class n extends d{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof y))return!1;let l=u(r),c=s.fromHexInput(l).toUint8Array(),x=A(c),S=i.toUint8Array();return o.verify(S,x,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new n(r)}static isPublicKey(e){return e instanceof n}};n.LENGTH=65;var m=n,t=class t extends g{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==t.LENGTH)throw new Error(`PrivateKey length should be ${t.LENGTH}`);this.key=r}static generate(){let e=o.utils.randomPrivateKey();return new t(e)}static fromDerivationPath(e,r){if(!h(e))throw new Error(`Invalid derivation path ${e}`);return t.fromDerivationPathInner(e,f(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=U.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new t(i)}sign(e){let r=u(e),i=s.fromHexInput(r),l=A(i.toUint8Array()),c=o.sign(l,this.key.toUint8Array(),{lowS:!0});return new y(c.toCompactRawBytes())}publicKey(){let e=o.getPublicKey(this.key.toUint8Array(),!1);return new m(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new t(r)}static isPrivateKey(e){return e instanceof t}};t.LENGTH=32;var H=t,a=class a extends v{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new a(r)}};a.LENGTH=64;var y=a;export{m as a,H as b,y as c};
|
|
2
|
+
//# sourceMappingURL=chunk-AVWAYKNS.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as x,h as P}from"./chunk-7Y6AWDBZ.mjs";import{a as R}from"./chunk-AH44UPM4.mjs";import{b as c,d as A}from"./chunk-M4Q4XDVR.mjs";import{a as C}from"./chunk-RKHPXZM6.mjs";import{a as h}from"./chunk-JCDZ2WXX.mjs";import{d as w}from"./chunk-YE5B2S5L.mjs";async function v(s){let{aptosConfig:n,options:t}=s;return A({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function D(s){let{aptosConfig:n}=s;return R(async()=>{let{data:t}=await c({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function N(s){let{aptosConfig:n,ledgerVersion:t}=s,{data:o}=await c({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return o}async function T(s){let{aptosConfig:n,transactionHash:t}=s,{data:o}=await c({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return o}async function G(s){let{aptosConfig:n,transactionHash:t}=s;try{return(await T({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(o){if(o?.status===404)return!0;throw o}}async function b(s){let{aptosConfig:n,transactionHash:t}=s,{data:o}=await c({aptosConfig:n,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return o}async function W(s){let{aptosConfig:n,transactionHash:t,options:o}=s,r=o?.timeoutSecs??20,u=o?.checkSuccess??!0,a=!0,p=0,e,g,m=200,E=1.5;function d(i){if(!(i instanceof C)||(g=i,i.status!==404&&i.status>=400&&i.status<500))throw i}try{e=await T({aptosConfig:n,transactionHash:t}),a=e.type==="pending_transaction"}catch(i){d(i)}if(a){let i=Date.now();try{e=await b({aptosConfig:n,transactionHash:t}),a=e.type==="pending_transaction"}catch(l){d(l)}p=(Date.now()-i)/1e3}for(;a&&!(p>=r);){try{if(e=await T({aptosConfig:n,transactionHash:t}),a=e.type==="pending_transaction",!a)break}catch(i){d(i)}await h(m),p+=m/1e3,m*=E}if(e===void 0)throw g||new f(`Fetching transaction ${t} failed and timed out after ${r} seconds`,e);if(e.type==="pending_transaction")throw new f(`Transaction ${t} timed out in pending state after ${r} seconds`,e);if(!u)return e;if(!e.success)throw new y(`Transaction ${t} failed with an error: ${e.vm_status}`,e);return e}async function O(s){let{aptosConfig:n,processorType:t}=s,o=BigInt(s.minimumLedgerVersion),r=3e3,u=new Date().getTime(),a=BigInt(-1);for(;a<o;){if(new Date().getTime()-u>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?a=await x({aptosConfig:n}):a=(await P({aptosConfig:n,processorType:t})).last_success_version,a>=o)break;await h(200)}}var f=class extends Error{constructor(t,o){super(t);this.lastSubmittedTransaction=o}},y=class extends Error{constructor(t,o){super(t);this.transaction=o}};export{v as a,D as b,N as c,T as d,G as e,b as f,W as g,O as h,f as i,y as j};
|
|
2
|
+
//# sourceMappingURL=chunk-BNA3SGG6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-3DP4R3FI.mjs";import{a as e}from"./chunk-ISXBJPLD.mjs";import{a as r}from"./chunk-272NA6H5.mjs";var n=class o extends r{constructor(t,a){super();this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CEGCSC3T.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as T}from"./chunk-SZ6KR73C.mjs";import{a as S,b as d}from"./chunk-3SXTTG2X.mjs";import{a as x,c as I,d as B,e as D}from"./chunk-ZAXWW7VW.mjs";import{a as H,c as U}from"./chunk-WOLLRMXR.mjs";import{b as K}from"./chunk-AUAL3H36.mjs";import{a as g}from"./chunk-J577ODDM.mjs";import{a as G}from"./chunk-NGTNMV6Q.mjs";import{a as A}from"./chunk-WXLSJF4A.mjs";import{a as m,b as E}from"./chunk-272NA6H5.mjs";import{b as u}from"./chunk-AOCNYMMX.mjs";var C=1e7,_=120,M=30,O=330,ie=120,re=350,ae=300,ne=93,l=class l extends K{constructor(e,t){super();let i=u.fromHexInput(t).toUint8Array();if(i.length!==l.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${l.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new E;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),G.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return u.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new l(t,i)}static load(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new l(t,i)}static isPublicKey(e){return e instanceof l}static create(e){return v(e),new l(e.iss,v(e))}};l.ID_COMMITMENT_LENGTH=32;var z=l;function v(a){let{uidKey:r,uidVal:e,aud:t,pepper:i}=a,n=[I(u.fromHexInput(i).toUint8Array()),x(t,_),x(e,O),x(r,M)];return B(D(n),z.ID_COMMITMENT_LENGTH)}var P=class a extends g{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:i,expiryDateSecs:n,ephemeralPublicKey:s,ephemeralSignature:o}=e;this.jwtHeader=t,this.ephemeralCertificate=i,this.expiryDateSecs=n,this.ephemeralPublicKey=s,this.ephemeralSignature=o}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=h.deserialize(e),i=e.deserializeStr(),n=e.deserializeU64(),s=S.deserialize(e),o=d.deserialize(e);return new a({jwtHeader:i,expiryDateSecs:Number(n),ephemeralCertificate:t,ephemeralPublicKey:s,ephemeralSignature:o})}static load(e){let t=h.deserialize(e),i=e.deserializeStr(),n=e.deserializeU64(),s=S.deserialize(e),o=d.deserialize(e);return new a({jwtHeader:i,expiryDateSecs:Number(n),ephemeralCertificate:t,ephemeralPublicKey:s,ephemeralSignature:o})}static getSimulationSignature(){return new a({jwtHeader:"{}",ephemeralCertificate:new h(new f({proof:new y(new b({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0)}),0),expiryDateSecs:0,ephemeralPublicKey:new S(new H(new Uint8Array(32))),ephemeralSignature:new d(new U(new Uint8Array(64)))})}static isSignature(e){return e instanceof a}},h=class a extends g{constructor(e,t){super();this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new a(f.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},c=class a extends m{constructor(e){super();if(this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new a(t)}},p=class a extends m{constructor(e){super();if(this.data=u.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new a(t)}},b=class a extends T{constructor(e){super();let{a:t,b:i,c:n}=e;this.a=new c(t),this.b=new p(i),this.c=new c(n)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=c.deserialize(e).bcsToBytes(),i=p.deserialize(e).bcsToBytes(),n=c.deserialize(e).bcsToBytes();return new a({a:t,b:i,c:n})}},y=class a extends m{constructor(e,t){super();this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new a(b.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},f=class a extends g{constructor(e){super();let{proof:t,expHorizonSecs:i=BigInt(C),trainingWheelsSignature:n,extraField:s,overrideAudVal:o}=e;this.proof=t,this.expHorizonSecs=i,this.trainingWheelsSignature=n,this.extraField=s,this.overrideAudVal=o}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return a.deserialize(new A(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=y.deserialize(e),i=e.deserializeU64(),n=e.deserializeOptionStr(),s=e.deserializeOptionStr(),o=e.deserializeOption(d);return new a({proof:t,expHorizonSecs:i,trainingWheelsSignature:o,extraField:n,overrideAudVal:s})}static load(e){let t=y.deserialize(e),i=e.deserializeU64(),n=e.deserializeOptionStr(),s=e.deserializeOptionStr(),o=e.deserializeOption(d);return new a({proof:t,expHorizonSecs:i,trainingWheelsSignature:o,extraField:n,overrideAudVal:s})}},V=class a{constructor(r,e){this.verficationKey=r,this.maxExpHorizonSecs=e}static create(r,e){return new a(new w({alphaG1:r.alpha_g1,betaG2:r.beta_g2,deltaG2:r.delta_g2,gammaAbcG1:r.gamma_abc_g1,gammaG2:r.gamma_g2}),e)}},w=class a{constructor(r){let{alphaG1:e,betaG2:t,deltaG2:i,gammaAbcG1:n,gammaG2:s}=r;this.alphaG1=new c(e),this.betaG2=new p(t),this.deltaG2=new p(i),this.gammaAbcG1=[new c(n[0]),new c(n[1])],this.gammaG2=new p(s)}static fromGroth16VerificationKeyResponse(r){return new a({alphaG1:r.alpha_g1,betaG2:r.beta_g2,deltaG2:r.delta_g2,gammaAbcG1:r.gamma_abc_g1,gammaG2:r.gamma_g2})}};export{C as a,_ as b,M as c,O as d,ie as e,re as f,ae as g,ne as h,z as i,P as j,h as k,b as l,y as m,f as n,V as o};
|
|
2
|
+
//# sourceMappingURL=chunk-CIPPNT3W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Deserializer, Serializable, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport { HexInput, EphemeralCertificateVariant, AnyPublicKeyVariant, SigningScheme, ZkpVariant } from \"../../types\";\nimport { EphemeralPublicKey, EphemeralSignature } from \"./ephemeral\";\nimport { bigIntToBytesLE, bytesToBigIntLE, hashStrToField, poseidonHash } from \"./poseidon\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Proof } from \"./proof\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Groth16VerificationKeyResponse } from \"../../types/keyless\";\n\nexport const EPK_HORIZON_SECS = 10000000;\nexport const MAX_AUD_VAL_BYTES = 120;\nexport const MAX_UID_KEY_BYTES = 30;\nexport const MAX_UID_VAL_BYTES = 330;\nexport const MAX_ISS_VAL_BYTES = 120;\nexport const MAX_EXTRA_FIELD_BYTES = 350;\nexport const MAX_JWT_HEADER_B64_BYTES = 300;\nexport const MAX_COMMITED_EPK_BYTES = 93;\n\n/**\n * Represents the KeylessPublicKey public key\n *\n * KeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class KeylessPublicKey extends AccountPublicKey {\n static readonly ID_COMMITMENT_LENGTH: number = 32;\n\n /**\n * The value of the 'iss' claim on the JWT which identifies the OIDC provider.\n */\n readonly iss: string;\n\n /**\n * A value representing a cryptographic commitment to a user identity.\n * \n * It is calculated from the aud, uidKey, uidVal, pepper.\n */\n readonly idCommitment: Uint8Array;\n\n constructor(iss: string, idCommitment: HexInput) {\n super();\n const idcBytes = Hex.fromHexInput(idCommitment).toUint8Array();\n if (idcBytes.length !== KeylessPublicKey.ID_COMMITMENT_LENGTH) {\n throw new Error(`Id Commitment length in bytes should be ${KeylessPublicKey.ID_COMMITMENT_LENGTH}`);\n }\n this.iss = iss;\n this.idCommitment = idcBytes;\n }\n\n /**\n * Get the authentication key for the keyless public key\n *\n * @returns AuthenticationKey\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Keyless);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: SigningScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key\n */\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n /**\n * Verifies a signed data with a public key\n *\n * @param args.message message\n * @param args.signature The signature\n * @returns true if the signature is valid\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {\n throw new Error(\"Not yet implemented\");\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.iss);\n serializer.serializeBytes(this.idCommitment);\n }\n\n static deserialize(deserializer: Deserializer): KeylessPublicKey {\n const iss = deserializer.deserializeStr();\n const addressSeed = deserializer.deserializeBytes();\n return new KeylessPublicKey(iss, addressSeed);\n }\n\n static load(deserializer: Deserializer): KeylessPublicKey {\n const iss = deserializer.deserializeStr();\n const addressSeed = deserializer.deserializeBytes();\n return new KeylessPublicKey(iss, addressSeed);\n }\n\n static isPublicKey(publicKey: PublicKey): publicKey is KeylessPublicKey {\n return publicKey instanceof KeylessPublicKey;\n }\n\n /**\n * Creates a KeylessPublicKey from the JWT components plus pepper\n *\n * @param args.iss the iss of the identity\n * @param args.uidKey the key to use to get the uidVal in the JWT token\n * @param args.uidVal the value of the uidKey in the JWT token\n * @param args.aud the client ID of the application\n * @param args.pepper The pepper used to maintain privacy of the account\n * @returns KeylessPublicKey\n */\n static create(args: {\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n }): KeylessPublicKey {\n computeIdCommitment(args);\n return new KeylessPublicKey(args.iss, computeIdCommitment(args));\n }\n}\n\nfunction computeIdCommitment(args: { uidKey: string; uidVal: string; aud: string; pepper: HexInput }): Uint8Array {\n const { uidKey, uidVal, aud, pepper } = args;\n\n const fields = [\n bytesToBigIntLE(Hex.fromHexInput(pepper).toUint8Array()),\n hashStrToField(aud, MAX_AUD_VAL_BYTES),\n hashStrToField(uidVal, MAX_UID_VAL_BYTES),\n hashStrToField(uidKey, MAX_UID_KEY_BYTES),\n ];\n\n return bigIntToBytesLE(poseidonHash(fields), KeylessPublicKey.ID_COMMITMENT_LENGTH);\n}\n\n/**\n * A signature of a message signed via Keyless Accounnt that uses proofs or the jwt token to authenticate.\n */\nexport class KeylessSignature extends Signature {\n /**\n * The inner signature ZeroKnowledgeSigniature or OpenIdSignature\n */\n readonly ephemeralCertificate: EphemeralCertificate;\n\n /**\n * The jwt header in the token used to create the proof/signature. In json string representation.\n */\n readonly jwtHeader: string;\n\n /**\n * The expiry timestamp in seconds of the EphemeralKeyPair used to sign\n */\n readonly expiryDateSecs: number;\n\n /**\n * The ephemeral public key used to verify the signature\n */\n readonly ephemeralPublicKey: EphemeralPublicKey;\n\n /**\n * The signature resulting from signing with the private key of the EphemeralKeyPair\n */\n readonly ephemeralSignature: EphemeralSignature;\n\n constructor(args: {\n jwtHeader: string;\n ephemeralCertificate: EphemeralCertificate;\n expiryDateSecs: number;\n ephemeralPublicKey: EphemeralPublicKey;\n ephemeralSignature: EphemeralSignature;\n }) {\n super();\n const { jwtHeader, ephemeralCertificate, expiryDateSecs, ephemeralPublicKey, ephemeralSignature } = args;\n this.jwtHeader = jwtHeader;\n this.ephemeralCertificate = ephemeralCertificate;\n this.expiryDateSecs = expiryDateSecs;\n this.ephemeralPublicKey = ephemeralPublicKey;\n this.ephemeralSignature = ephemeralSignature;\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n serialize(serializer: Serializer): void {\n this.ephemeralCertificate.serialize(serializer);\n serializer.serializeStr(this.jwtHeader);\n serializer.serializeU64(this.expiryDateSecs);\n this.ephemeralPublicKey.serialize(serializer);\n this.ephemeralSignature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessSignature {\n const ephemeralCertificate = EphemeralCertificate.deserialize(deserializer);\n const jwtHeader = deserializer.deserializeStr();\n const expiryDateSecs = deserializer.deserializeU64();\n const ephemeralPublicKey = EphemeralPublicKey.deserialize(deserializer);\n const ephemeralSignature = EphemeralSignature.deserialize(deserializer);\n return new KeylessSignature({\n jwtHeader,\n expiryDateSecs: Number(expiryDateSecs),\n ephemeralCertificate,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n static load(deserializer: Deserializer): KeylessSignature {\n const ephemeralCertificate = EphemeralCertificate.deserialize(deserializer);\n const jwtHeader = deserializer.deserializeStr();\n const expiryDateSecs = deserializer.deserializeU64();\n const ephemeralPublicKey = EphemeralPublicKey.deserialize(deserializer);\n const ephemeralSignature = EphemeralSignature.deserialize(deserializer);\n return new KeylessSignature({\n jwtHeader,\n expiryDateSecs: Number(expiryDateSecs),\n ephemeralCertificate,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n static getSimulationSignature(): KeylessSignature {\n return new KeylessSignature({\n jwtHeader: \"{}\",\n ephemeralCertificate: new EphemeralCertificate(\n new ZeroKnowledgeSig({\n proof: new ZkProof(\n new Groth16Zkp({ a: new Uint8Array(32), b: new Uint8Array(64), c: new Uint8Array(32) }),\n ZkpVariant.Groth16,\n ),\n }),\n EphemeralCertificateVariant.ZkProof,\n ),\n expiryDateSecs: 0,\n ephemeralPublicKey: new EphemeralPublicKey(new Ed25519PublicKey(new Uint8Array(32))),\n ephemeralSignature: new EphemeralSignature(new Ed25519Signature(new Uint8Array(64))),\n });\n }\n\n static isSignature(signature: Signature): signature is KeylessSignature {\n return signature instanceof KeylessSignature;\n }\n}\n\n/**\n * A container for a signature that is a ZeroKnowledgeSig. Can be expanded to support OpenIdSignature.\n */\nexport class EphemeralCertificate extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: EphemeralCertificateVariant;\n\n constructor(signature: Signature, variant: EphemeralCertificateVariant) {\n super();\n this.signature = signature;\n this.variant = variant;\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.signature.toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): EphemeralCertificate {\n const variant = deserializer.deserializeUleb128AsU32();\n switch (variant) {\n case EphemeralCertificateVariant.ZkProof:\n return new EphemeralCertificate(ZeroKnowledgeSig.deserialize(deserializer), variant);\n default:\n throw new Error(`Unknown variant index for EphemeralCertificate: ${variant}`);\n }\n }\n}\n\nclass G1Bytes extends Serializable {\n data: Uint8Array;\n\n constructor(data: HexInput) {\n super();\n this.data = Hex.fromHexInput(data).toUint8Array();\n if (this.data.length !== 32) {\n throw new Error(\"Input needs to be 32 bytes\");\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n static deserialize(deserializer: Deserializer): G1Bytes {\n const bytes = deserializer.deserializeFixedBytes(32);\n return new G1Bytes(bytes);\n }\n}\n\nclass G2Bytes extends Serializable {\n data: Uint8Array;\n\n constructor(data: HexInput) {\n super();\n this.data = Hex.fromHexInput(data).toUint8Array();\n if (this.data.length !== 64) {\n throw new Error(\"Input needs to be 64 bytes\");\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n static deserialize(deserializer: Deserializer): G2Bytes {\n const bytes = deserializer.deserializeFixedBytes(64);\n return new G2Bytes(bytes);\n }\n}\n\n/**\n * A representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof.\n */\nexport class Groth16Zkp extends Proof {\n /**\n * The bytes of G1 proof point a\n */\n a: G1Bytes;\n\n /**\n * The bytes of G2 proof point b\n */\n b: G2Bytes;\n\n /**\n * The bytes of G1 proof point c\n */\n c: G1Bytes;\n\n constructor(args: { a: HexInput; b: HexInput; c: HexInput }) {\n super();\n const { a, b, c } = args;\n this.a = new G1Bytes(a)\n this.b = new G2Bytes(b)\n this.c = new G1Bytes(c)\n }\n\n serialize(serializer: Serializer): void {\n this.a.serialize(serializer);\n this.b.serialize(serializer);\n this.c.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): Groth16Zkp {\n const a = G1Bytes.deserialize(deserializer).bcsToBytes();\n const b = G2Bytes.deserialize(deserializer).bcsToBytes();\n const c = G1Bytes.deserialize(deserializer).bcsToBytes();\n return new Groth16Zkp({ a, b, c });\n }\n}\n\n/**\n * A container for a different zero knowledge proof types\n */\nexport class ZkProof extends Serializable {\n public readonly proof: Proof;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: ZkpVariant;\n\n constructor(proof: Proof, variant: ZkpVariant) {\n super();\n this.proof = proof;\n this.variant = variant;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): ZkProof {\n const variant = deserializer.deserializeUleb128AsU32();\n switch (variant) {\n case ZkpVariant.Groth16:\n return new ZkProof(Groth16Zkp.deserialize(deserializer), variant);\n default:\n throw new Error(`Unknown variant index for ZkProof: ${variant}`);\n }\n }\n}\n\n/**\n * The signature representation of a proof\n */\nexport class ZeroKnowledgeSig extends Signature {\n /**\n * The proof\n */\n readonly proof: ZkProof;\n\n /**\n * The max lifespan of the proof\n */\n readonly expHorizonSecs: bigint;\n\n /**\n * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain.\n * Can be used to assert identity or other attributes.\n */\n readonly extraField?: string;\n\n /**\n * The 'aud' value of the recovery service which is set when recovering an account.\n */\n readonly overrideAudVal?: string;\n\n /**\n * The training wheels signature\n */\n readonly trainingWheelsSignature?: EphemeralSignature;\n\n constructor(args: {\n proof: ZkProof;\n expHorizonSecs?: bigint;\n extraField?: string;\n overrideAudVal?: string;\n trainingWheelsSignature?: EphemeralSignature;\n }) {\n super();\n const {\n proof,\n expHorizonSecs = BigInt(EPK_HORIZON_SECS),\n trainingWheelsSignature,\n extraField,\n overrideAudVal,\n } = args;\n this.proof = proof;\n this.expHorizonSecs = expHorizonSecs;\n this.trainingWheelsSignature = trainingWheelsSignature;\n this.extraField = extraField;\n this.overrideAudVal = overrideAudVal;\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Return a ZeroKnowledgeSig object from its bcs serialization in bytes.\n *\n * @returns ZeroKnowledgeSig\n */\n static fromBytes(bytes: Uint8Array): ZeroKnowledgeSig {\n return ZeroKnowledgeSig.deserialize(new Deserializer(bytes));\n }\n\n serialize(serializer: Serializer): void {\n this.proof.serialize(serializer);\n serializer.serializeU64(this.expHorizonSecs);\n serializer.serializeOptionStr(this.extraField);\n serializer.serializeOptionStr(this.overrideAudVal);\n serializer.serializeOption(this.trainingWheelsSignature);\n }\n\n static deserialize(deserializer: Deserializer): ZeroKnowledgeSig {\n const proof = ZkProof.deserialize(deserializer);\n const expHorizonSecs = deserializer.deserializeU64();\n const extraField = deserializer.deserializeOptionStr();\n const overrideAudVal = deserializer.deserializeOptionStr();\n const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);\n return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });\n }\n\n static load(deserializer: Deserializer): ZeroKnowledgeSig {\n const proof = ZkProof.deserialize(deserializer);\n const expHorizonSecs = deserializer.deserializeU64();\n const extraField = deserializer.deserializeOptionStr();\n const overrideAudVal = deserializer.deserializeOptionStr();\n const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);\n return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });\n }\n}\n\nexport class KeylessConfiguration {\n readonly verficationKey: Groth16VerificationKey;\n\n readonly maxExpHorizonSecs: number;\n\n constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {\n this.verficationKey = verficationKey;\n this.maxExpHorizonSecs = maxExpHorizonSecs;\n }\n\n static create(res: Groth16VerificationKeyResponse, maxExpHorizonSecs: number): KeylessConfiguration {\n return new KeylessConfiguration(new Groth16VerificationKey({\n alphaG1: res.alpha_g1,\n betaG2: res.beta_g2,\n deltaG2: res.delta_g2,\n gammaAbcG1: res.gamma_abc_g1,\n gammaG2: res.gamma_g2\n }), maxExpHorizonSecs)\n }\n\n}\n \n class Groth16VerificationKey {\n readonly alphaG1: G1Bytes;\n\n readonly betaG2: G2Bytes;\n\n readonly deltaG2: G2Bytes;\n\n readonly gammaAbcG1: G1Bytes[];\n\n readonly gammaG2: G2Bytes;\n \n constructor(args: {\n alphaG1: HexInput;\n betaG2: HexInput;\n deltaG2: HexInput;\n gammaAbcG1: [HexInput, HexInput];\n gammaG2: HexInput;\n }) {\n const {\n alphaG1,\n betaG2,\n deltaG2,\n gammaAbcG1,\n gammaG2,\n } = args;\n this.alphaG1 = new G1Bytes(alphaG1)\n this.betaG2 = new G2Bytes(betaG2)\n this.deltaG2 = new G2Bytes(deltaG2)\n this.gammaAbcG1 = [new G1Bytes(gammaAbcG1[0]), new G1Bytes(gammaAbcG1[1])]\n this.gammaG2 =new G2Bytes(gammaG2)\n }\n\n static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey {\n return new Groth16VerificationKey({\n alphaG1: res.alpha_g1,\n betaG2: res.beta_g2,\n deltaG2: res.delta_g2,\n gammaAbcG1: res.gamma_abc_g1,\n gammaG2: res.gamma_g2\n })\n }\n }\n"],"mappings":"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","names":["EPK_HORIZON_SECS","MAX_AUD_VAL_BYTES","MAX_UID_KEY_BYTES","MAX_UID_VAL_BYTES","MAX_ISS_VAL_BYTES","MAX_EXTRA_FIELD_BYTES","MAX_JWT_HEADER_B64_BYTES","MAX_COMMITED_EPK_BYTES","_KeylessPublicKey","AccountPublicKey","iss","idCommitment","idcBytes","Hex","serializer","Serializer","AuthenticationKey","args","deserializer","addressSeed","publicKey","computeIdCommitment","KeylessPublicKey","uidKey","uidVal","aud","pepper","fields","bytesToBigIntLE","hashStrToField","bigIntToBytesLE","poseidonHash","KeylessSignature","_KeylessSignature","Signature","jwtHeader","ephemeralCertificate","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","EphemeralCertificate","EphemeralPublicKey","EphemeralSignature","ZeroKnowledgeSig","ZkProof","Groth16Zkp","Ed25519PublicKey","Ed25519Signature","signature","_EphemeralCertificate","variant","G1Bytes","_G1Bytes","Serializable","data","bytes","G2Bytes","_G2Bytes","_Groth16Zkp","Proof","a","b","c","_ZkProof","proof","_ZeroKnowledgeSig","expHorizonSecs","trainingWheelsSignature","extraField","overrideAudVal","Deserializer","KeylessConfiguration","_KeylessConfiguration","verficationKey","maxExpHorizonSecs","res","Groth16VerificationKey","_Groth16VerificationKey","alphaG1","betaG2","deltaG2","gammaAbcG1","gammaG2"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as p}from"./chunk-OZ3GSAFK.mjs";import{d as s}from"./chunk-HGRU3HWY.mjs";import{a as u,b as y}from"./chunk-QYEJOEWB.mjs";import{b as a}from"./chunk-AVWAYKNS.mjs";import{b as i}from"./chunk-WOLLRMXR.mjs";import{b as g}from"./chunk-WHSN42R2.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CZOUSIAD.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b,c as K}from"./chunk-JCDZ2WXX.mjs";import{a as d}from"./chunk-CIPPNT3W.mjs";import{a as l,b as y}from"./chunk-3SXTTG2X.mjs";import{b as u,c as h,e as m}from"./chunk-ZAXWW7VW.mjs";import{b as a}from"./chunk-WOLLRMXR.mjs";import{a as o}from"./chunk-WXLSJF4A.mjs";import{a as p}from"./chunk-272NA6H5.mjs";import{b as c}from"./chunk-AOCNYMMX.mjs";import{randomBytes as E}from"@noble/hashes/utils";var i=class i extends p{constructor(e){super();let{privateKey:r,expiryDateSecs:t,blinder:n}=e;this.privateKey=r,this.publicKey=new l(r.publicKey()),this.expiryDateSecs=t||K(b()+d),this.blinder=n!==void 0?c.fromHexInput(n).toUint8Array():S(),this.nonce=this.generateNonce()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),t;switch(r){case 0:t=a.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let n=e.deserializeU64(),x=e.deserializeFixedBytes(31);return new i({privateKey:t,expiryDateSecs:Number(n),blinder:x})}static fromBytes(e){return i.deserialize(new o(e))}static generate(e){let r;switch(e?.scheme){case 0:default:r=a.generate()}return new i({privateKey:r,expiryDateSecs:e?.expiryDateSecs})}generateNonce(){let e=u(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(h(this.blinder)),m(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new y(this.privateKey.sign(e))}};i.BLINDER_LENGTH=31;var s=i;function S(){return E(s.BLINDER_LENGTH)}export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-D76FE35G.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/account/EphemeralKeyPair.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { randomBytes } from \"@noble/hashes/utils\";\n\nimport {\n EPK_HORIZON_SECS,\n Ed25519PrivateKey,\n EphemeralPublicKey,\n EphemeralSignature,\n PrivateKey,\n} from \"../core/crypto\";\nimport { Hex } from \"../core/hex\";\nimport { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from \"../core/crypto/poseidon\";\nimport { EphemeralPublicKeyVariant, HexInput } from \"../types\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { currentTimeInSeconds, floorToWholeHour } from \"../utils/helpers\";\n\nexport class EphemeralKeyPair extends Serializable {\n static readonly BLINDER_LENGTH: number = 31;\n\n /**\n * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP.\n * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.\n */\n readonly blinder: Uint8Array;\n\n /**\n * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new\n * EphemeralKeyPair must be generated and a new JWT needs to be created.\n */\n readonly expiryDateSecs: number;\n\n /**\n * The value passed to the IdP when the user authenticates. It comprises of a hash of the\n * ephermeral public key, expiry date, and blinder.\n */\n readonly nonce: string;\n\n /**\n * A private key used to sign transactions. This private key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private privateKey: PrivateKey;\n\n /**\n * A public key used to verify transactions. This public key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private publicKey: EphemeralPublicKey;\n\n constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput }) {\n super();\n const { privateKey, expiryDateSecs, blinder } = args;\n this.privateKey = privateKey;\n this.publicKey = new EphemeralPublicKey(privateKey.publicKey());\n // We set the expiry date to be the nearest floored hour\n this.expiryDateSecs = expiryDateSecs || floorToWholeHour(currentTimeInSeconds() + EPK_HORIZON_SECS);\n // Generate the blinder if not provided\n this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();\n // Calculate the nonce\n this.nonce = this.generateNonce();\n }\n\n /**\n * Returns the public key of the key pair.\n * @return EphemeralPublicKey\n */\n getPublicKey(): EphemeralPublicKey {\n return this.publicKey;\n }\n\n /**\n * Returns the public key of the key pair.\n * @return boolean\n */\n isExpired(): boolean {\n const currentTimeSecs: number = Math.floor(Date.now() / 1000);\n return currentTimeSecs > this.expiryDateSecs;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.publicKey.variant);\n serializer.serializeBytes(this.privateKey.toUint8Array());\n serializer.serializeU64(this.expiryDateSecs);\n serializer.serializeFixedBytes(this.blinder);\n }\n\n static deserialize(deserializer: Deserializer): EphemeralKeyPair {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let privateKey: PrivateKey;\n switch (variantIndex) {\n case EphemeralPublicKeyVariant.Ed25519:\n privateKey = Ed25519PrivateKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);\n }\n const expiryDateSecs = deserializer.deserializeU64();\n const blinder = deserializer.deserializeFixedBytes(31);\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: Number(expiryDateSecs), blinder });\n }\n\n static fromBytes(bytes: Uint8Array): EphemeralKeyPair {\n return EphemeralKeyPair.deserialize(new Deserializer(bytes));\n }\n\n /**\n * Returns the public key of the key pair.\n * @param scheme the type of keypair to use for the EphemeralKeyPair. Only Ed25519 supported for now.\n * @param expiryDateSecs the date of expiry.\n * @return boolean\n */\n static generate(args?: { scheme: EphemeralPublicKeyVariant; expiryDateSecs?: number }): EphemeralKeyPair {\n let privateKey: PrivateKey;\n\n switch (args?.scheme) {\n case EphemeralPublicKeyVariant.Ed25519:\n default:\n privateKey = Ed25519PrivateKey.generate();\n }\n\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: args?.expiryDateSecs });\n }\n\n /**\n * From the ephemeral public key, expiry timestamp, and blinder, calculate the nonce to be used at authentication via OIDC.\n * @returns string\n */\n private generateNonce(): string {\n const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);\n fields.push(BigInt(this.expiryDateSecs));\n fields.push(bytesToBigIntLE(this.blinder));\n const nonceHash = poseidonHash(fields);\n return nonceHash.toString();\n }\n\n /**\n * Sign the given message with the private key.\n * @param data in HexInput format\n * @returns EphemeralSignature\n */\n sign(data: HexInput): EphemeralSignature {\n if (this.isExpired()) {\n throw new Error(\"EphemeralKeyPair has expired\");\n }\n return new EphemeralSignature(this.privateKey.sign(data));\n }\n}\n\n/**\n * Generates a random byte array of length EphemeralKeyPair.BLINDER_LENGTH\n * @returns Uint8Array\n */\nfunction generateBlinder(): Uint8Array {\n return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);\n}\n"],"mappings":"+VAGA,OAAS,eAAAA,MAAmB,sBAerB,IAAMC,EAAN,MAAMA,UAAyBC,CAAa,CAiCjD,YAAYC,EAA+E,CACzF,MAAM,EACN,GAAM,CAAE,WAAAC,EAAY,eAAAC,EAAgB,QAAAC,CAAQ,EAAIH,EAChD,KAAK,WAAaC,EAClB,KAAK,UAAY,IAAIG,EAAmBH,EAAW,UAAU,CAAC,EAE9D,KAAK,eAAiBC,GAAkBG,EAAiBC,EAAqB,EAAIC,CAAgB,EAElG,KAAK,QAAUJ,IAAY,OAAYK,EAAI,aAAaL,CAAO,EAAE,aAAa,EAAIM,EAAgB,EAElG,KAAK,MAAQ,KAAK,cAAc,CAClC,CAMA,cAAmC,CACjC,OAAO,KAAK,SACd,CAMA,WAAqB,CAEnB,OADgC,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EACnC,KAAK,cAChC,CAEA,UAAUC,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,UAAU,OAAO,EACvDA,EAAW,eAAe,KAAK,WAAW,aAAa,CAAC,EACxDA,EAAW,aAAa,KAAK,cAAc,EAC3CA,EAAW,oBAAoB,KAAK,OAAO,CAC7C,CAEA,OAAO,YAAYC,EAA8C,CAC/D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDV,EACJ,OAAQW,EAAc,CACpB,OACEX,EAAaY,EAAkB,YAAYF,CAAY,EACvD,MACF,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAY,EAAE,CACnF,CACA,IAAMV,EAAiBS,EAAa,eAAe,EAC7CR,EAAUQ,EAAa,sBAAsB,EAAE,EACrD,OAAO,IAAIb,EAAiB,CAAE,WAAAG,EAAY,eAAgB,OAAOC,CAAc,EAAG,QAAAC,CAAQ,CAAC,CAC7F,CAEA,OAAO,UAAUW,EAAqC,CACpD,OAAOhB,EAAiB,YAAY,IAAIiB,EAAaD,CAAK,CAAC,CAC7D,CAQA,OAAO,SAASd,EAAyF,CACvG,IAAIC,EAEJ,OAAQD,GAAM,OAAQ,CACpB,OACA,QACEC,EAAaY,EAAkB,SAAS,CAC5C,CAEA,OAAO,IAAIf,EAAiB,CAAE,WAAAG,EAAY,eAAgBD,GAAM,cAAe,CAAC,CAClF,CAMQ,eAAwB,CAC9B,IAAMgB,EAASC,EAAuB,KAAK,UAAU,WAAW,EAAG,EAAE,EACrE,OAAAD,EAAO,KAAK,OAAO,KAAK,cAAc,CAAC,EACvCA,EAAO,KAAKE,EAAgB,KAAK,OAAO,CAAC,EACvBC,EAAaH,CAAM,EACpB,SAAS,CAC5B,CAOA,KAAKI,EAAoC,CACvC,GAAI,KAAK,UAAU,EACjB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,OAAO,IAAIC,EAAmB,KAAK,WAAW,KAAKD,CAAI,CAAC,CAC1D,CACF,EAlIatB,EACK,eAAyB,GADpC,IAAMwB,EAANxB,EAwIP,SAASW,GAA8B,CACrC,OAAOc,EAAYD,EAAiB,cAAc,CACpD","names":["randomBytes","_EphemeralKeyPair","Serializable","args","privateKey","expiryDateSecs","blinder","EphemeralPublicKey","floorToWholeHour","currentTimeInSeconds","EPK_HORIZON_SECS","Hex","generateBlinder","serializer","deserializer","variantIndex","Ed25519PrivateKey","bytes","Deserializer","fields","padAndPackBytesWithLen","bytesToBigIntLE","poseidonHash","data","EphemeralSignature","EphemeralKeyPair","randomBytes"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as e}from"./chunk-BNA3SGG6.mjs";async function i(o){o.minimumLedgerVersion!==void 0&&await e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:o.processorType})}export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DSVNXD5A.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-VBODXPT3.mjs";import{a as g}from"./chunk-MLQT5I6K.mjs";import{a as p}from"./chunk-VMVSUH2K.mjs";import{b as y}from"./chunk-WHSN42R2.mjs";import{a as S}from"./chunk-MSGHGK52.mjs";import{a as v}from"./chunk-GS5Z3HO7.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-ZV5P2GSJ.mjs";import{a as u}from"./chunk-272NA6H5.mjs";function D(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(r);case 1:return E.deserialize(r);case 2:return _.deserialize(r);case 3:return y.deserialize(r);case 4:return v.deserialize(r,d);case 5:return F.deserialize(r);case 6:return T.deserialize(r);case 7:return x.deserialize(r);case 8:return w.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},A=class r extends a{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let i=U.deserialize(t);return new r(i)}},z=class r extends a{constructor(t){super();this.entryFunction=t}serialize(t){t.serializeU32AsUleb128(2),this.entryFunction.serialize(t)}static load(t){let i=l.deserialize(t);return new r(i)}},h=class r extends a{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let i=f.deserialize(t);return new r(i)}},l=class r{constructor(e,t,i,n){this.module_name=e,this.function_name=t,this.type_args=i,this.args=n}static build(e,t,i,n){return new r(g.fromStr(e),new p(t),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new r(t,i,n,s)}},U=class r{constructor(e,t,i){this.bytecode=e,this.type_args=t,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new r(t,i,o)}},f=class r{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new r(t,n)}},b=class r extends u{constructor(t){super();this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(l.deserialize(t))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
|
|
2
|
+
//# sourceMappingURL=chunk-EJ7ODMDA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as r,c as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as r,c as s}from"./chunk-R4HLV32L.mjs";import{a as t}from"./chunk-DSVNXD5A.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-EJURLI4L.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as x}from"./chunk-AH44UPM4.mjs";import{b as u}from"./chunk-M4Q4XDVR.mjs";import{e as K,f as C}from"./chunk-WSVJNBSJ.mjs";import{d as a}from"./chunk-MEOBWD6V.mjs";import{a as l,l as P,m as d,n as h,o as m}from"./chunk-CIPPNT3W.mjs";import{b as y}from"./chunk-3SXTTG2X.mjs";import{b as g}from"./chunk-WHSN42R2.mjs";import{b as i}from"./chunk-AOCNYMMX.mjs";async function L(e){let{aptosConfig:r}=e;return x(async()=>{let o=await _(e),t=await w(e);return m.create(t,Number(o.max_exp_horizon_secs))},`keyless-configuration-${r.network}`,1e3*60*5)()}async function _(e){let{aptosConfig:r,options:o}=e,t="0x1::keyless_account::Configuration",{data:n}=await u({aptosConfig:r,originMethod:"getKeylessConfiguration",path:`accounts/${g.from("0x1").toString()}/resource/${t}`,params:{ledger_version:o?.ledgerVersion}});return n.data}async function w(e){let{aptosConfig:r,options:o}=e,t="0x1::keyless_account::Groth16VerificationKey",{data:n}=await u({aptosConfig:r,originMethod:"getGroth16VerificationKey",path:`accounts/${g.from("0x1").toString()}/resource/${t}`,params:{ledger_version:o?.ledgerVersion}});return n.data}async function b(e){let{aptosConfig:r,jwt:o,ephemeralKeyPair:t,uidKey:n,derivationPath:s}=e,c={jwt_b64:o,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,epk_blinder:i.fromHexInput(t.blinder).toStringWithoutPrefix(),uid_key:n||"sub",derivation_path:s},{data:p}=await K({aptosConfig:r,path:"fetch",body:c,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return i.fromHexInput(p.pepper).toUint8Array()}async function R(e){let{aptosConfig:r,jwt:o,ephemeralKeyPair:t,pepper:n,uidKey:s}=e,c={jwt_b64:o,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:i.fromHexInput(t.blinder).toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,exp_horizon_secs:l,pepper:i.fromHexInput(n).toStringWithoutPrefix(),uid_key:s||"sub"},{data:p}=await C({aptosConfig:r,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),f=p.proof,A=new P({a:f.a,b:f.b,c:f.c});return new h({proof:new d(A,0),trainingWheelsSignature:y.fromHex(p.training_wheels_signature)})}async function M(e){let{proofFetchCallback:r}=e,{pepper:o}=e;if(o===void 0?o=await b(e):o=i.fromHexInput(o).toUint8Array(),o.length!==a.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${a.PEPPER_LENGTH} bytes`);let t=R({...e,pepper:o}),n=r?t:await t;return a.fromJWTAndProof({...e,proof:n,pepper:o,proofFetchCallback:r})}export{L as a,b,R as c,M as d};
|
|
2
|
+
//# sourceMappingURL=chunk-FUQDDIKQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/keyless.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/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n */\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosFullNode, postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddress,\n EPK_HORIZON_SECS,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessConfiguration,\n ZeroKnowledgeSig,\n ZkProof,\n} from \"../core\";\nimport { HexInput, LedgerVersionArg, MoveResource, ZkpVariant } from \"../types\";\nimport { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport {\n Groth16VerificationKeyResponse,\n KeylessConfigurationResponse,\n PepperFetchRequest,\n PepperFetchResponse,\n ProverRequest,\n ProverResponse,\n} from \"../types/keyless\";\nimport { memoizeAsync } from \"../utils/memoize\";\n\nexport async function getKeylessConfig(args: {\n aptosConfig: AptosConfig;\n options?: LedgerVersionArg;\n}): Promise<KeylessConfiguration> {\n const { aptosConfig } = args;\n return memoizeAsync(\n async () => {\n const config = await getKeylessConfiguration(args);\n const vk = await getGroth16VerificationKey(args);\n return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));\n },\n `keyless-configuration-${aptosConfig.network}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nasync function getKeylessConfiguration(args: {\n aptosConfig: AptosConfig;\n options?: LedgerVersionArg;\n}): Promise<KeylessConfigurationResponse> {\n const { aptosConfig, options } = args;\n const resourceType = \"0x1::keyless_account::Configuration\";\n const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({\n aptosConfig,\n originMethod: \"getKeylessConfiguration\",\n path: `accounts/${AccountAddress.from(\"0x1\").toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n\n return data.data;\n}\n\nasync function getGroth16VerificationKey(args: {\n aptosConfig: AptosConfig;\n options?: LedgerVersionArg;\n}): Promise<Groth16VerificationKeyResponse> {\n const { aptosConfig, options } = args;\n const resourceType = \"0x1::keyless_account::Groth16VerificationKey\";\n const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({\n aptosConfig,\n originMethod: \"getGroth16VerificationKey\",\n path: `accounts/${AccountAddress.from(\"0x1\").toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n\n return data.data;\n}\n\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey, derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey || \"sub\",\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n}): Promise<ZeroKnowledgeSig> {\n const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey } = args;\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: EPK_HORIZON_SECS,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey || \"sub\",\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n });\n return signedProof;\n}\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount> {\n const { proofFetchCallback } = args;\n let { pepper } = args;\n if (pepper === undefined) {\n pepper = await getPepper(args);\n } else {\n pepper = Hex.fromHexInput(pepper).toUint8Array();\n }\n\n if (pepper.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n\n const proofPromise = getProof({ ...args, pepper });\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proof, pepper, proofFetchCallback });\n\n return keylessAccount;\n}\n"],"mappings":"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","names":["getKeylessConfig","args","aptosConfig","memoizeAsync","config","getKeylessConfiguration","vk","getGroth16VerificationKey","KeylessConfiguration","options","resourceType","data","getAptosFullNode","AccountAddress","getPepper","jwt","ephemeralKeyPair","uidKey","derivationPath","body","Hex","postAptosPepperService","getProof","pepper","json","EPK_HORIZON_SECS","postAptosProvingService","proofPoints","groth16Zkp","Groth16Zkp","ZeroKnowledgeSig","ZkProof","EphemeralSignature","deriveKeylessAccount","proofFetchCallback","KeylessAccount","proofPromise","proof"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as r,b as o,d as i}from"./chunk-FUQDDIKQ.mjs";var t=class{constructor(e){this.config=e}async getKeylessConfig(e){return r({aptosConfig:this.config,options:e})}async getPepper(e){return o({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return i({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FWTJQHJR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { KeylessConfiguration } from \"../core\";\nimport { deriveKeylessAccount, getKeylessConfig, getPepper } from \"../internal/keyless\";\nimport { HexInput, LedgerVersionArg } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to query all `Keyless` related queries on Aptos.\n */\nexport class Keyless {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Gets the parameters of how Keyless Accounts are configured on chain.\n *\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns KeylessConfiguration\n */\n async getKeylessConfig(\n options?: LedgerVersionArg\n ): Promise<KeylessConfiguration> {\n return getKeylessConfig({ aptosConfig: this.config, options });\n }\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args.jwt JWT token\n * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token\n * @returns The pepper which is a Uint8Array of length 31.\n */\n async getPepper(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair }): Promise<Uint8Array> {\n return getPepper({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args.jwt JWT token\n * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token\n * @param args.uidKey a key in the JWT token to use to set the uidVal in the IdCommitment\n * @param args.pepper the pepper\n * @param args.proofFetchCallback a callback function that if set, the fetch of the proof will be done asyncronously. Once\n * if finishes the callback function will be called.\n * @returns A KeylessAccount that can be used to sign transactions\n */\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount> {\n return deriveKeylessAccount({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uDAYO,IAAMA,EAAN,KAAc,CACnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAQ3C,MAAM,iBACJC,EAC+B,CAC/B,OAAOC,EAAiB,CAAE,YAAa,KAAK,OAAQ,QAAAD,CAAQ,CAAC,CAC/D,CASA,MAAM,UAAUE,EAAgF,CAC9F,OAAOC,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACxD,CAaA,MAAM,qBAAqBA,EAMC,CAC1B,OAAOE,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACnE,CACF","names":["Keyless","config","options","getKeylessConfig","args","getPepper","deriveKeylessAccount"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-3DP4R3FI.mjs";import{b as i}from"./chunk-WHSN42R2.mjs";import{a as d}from"./chunk-272NA6H5.mjs";var o=class t extends d{constructor(e,s,r){super();this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GHHIUWPP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l,b as s,c as u,d as c,e as d,f as m,g as U}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l,b as s,c as u,d as c,e as d,f as m,g as U}from"./chunk-ZV5P2GSJ.mjs";import{a as o}from"./chunk-272NA6H5.mjs";import{b as z}from"./chunk-AOCNYMMX.mjs";var t=class n extends o{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof s)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=z.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(i=>new s(i)))}static U16(e){return new n(e.map(r=>new u(r)))}static U32(e){return new n(e.map(r=>new c(r)))}static U64(e){return new n(e.map(r=>new d(r)))}static U128(e){return new n(e.map(r=>new m(r)))}static U256(e){return new n(e.map(r=>new U(r)))}static Bool(e){return new n(e.map(r=>new l(r)))}static MoveString(e){return new n(e.map(r=>new a(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),y=new Array;for(let w=0;w<i;w+=1)y.push(r.deserialize(e));return new n(y)}},a=class n extends o{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);t.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},f=class n extends o{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new t([e]):this.vec=new t([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new s(e):void 0)}static U16(e){return new n(e!=null?new u(e):void 0)}static U32(e){return new n(e!=null?new c(e):void 0)}static U64(e){return new n(e!=null?new d(e):void 0)}static U128(e){return new n(e!=null?new m(e):void 0)}static U256(e){return new n(e!=null?new U(e):void 0)}static Bool(e){return new n(e!=null?new l(e):void 0)}static MoveString(e){return new n(e!=null?new a(e):void 0)}static deserialize(e,r){let i=t.deserialize(e,r);return new n(i.values[0])}};export{t as a,a as b,f as c};
|
|
2
|
+
//# sourceMappingURL=chunk-GS5Z3HO7.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b,b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as b,b as p}from"./chunk-RWYPGTNL.mjs";import{a as z,b as A}from"./chunk-J534ICWA.mjs";import{a as g,b as h}from"./chunk-QYEJOEWB.mjs";import{a as y,c as d}from"./chunk-WOLLRMXR.mjs";import{a as o}from"./chunk-272NA6H5.mjs";var u=class extends o{static deserialize(t){let i=t.deserializeUleb128AsU32();switch(i){case 0:return l.load(t);case 1:return n.load(t);case 2:return a.load(t);case 3:return c.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${i}`)}}isEd25519(){return this instanceof l}isMultiEd25519(){return this instanceof n}isSingleKey(){return this instanceof a}isMultiKey(){return this instanceof c}},l=class s extends u{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(0),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=y.deserialize(i),r=d.deserialize(i);return new s(e,r)}},n=class s extends u{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(1),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=b.deserialize(i),r=p.deserialize(i);return new s(e,r)}},a=class s extends u{constructor(i,e){super();this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(2),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=g.deserialize(i),r=h.deserialize(i);return new s(e,r)}},c=class s extends u{constructor(i,e){super();this.public_keys=i,this.signatures=e}serialize(i){i.serializeU32AsUleb128(3),this.public_keys.serialize(i),this.signatures.serialize(i)}static load(i){let e=z.deserialize(i),r=A.deserialize(i);return new s(e,r)}};export{u as a,l as b,n as c,a as d,c as e};
|
|
2
|
+
//# sourceMappingURL=chunk-HGRU3HWY.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as a}from"./chunk-7Y6AWDBZ.mjs";import{q as d}from"./chunk-S3EDNXZE.mjs";import{b as p}from"./chunk-WHSN42R2.mjs";var g=300,y=o=>{if(o&&o.length>g)throw new Error(`Event type length exceeds the maximum length of ${g}`)};async function f(o){let{aptosConfig:n,eventType:e,options:t}=o,r={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:t,orderBy:t?.orderBy};return c({aptosConfig:n,options:r})}async function h(o){let{accountAddress:n,aptosConfig:e,creationNumber:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},creation_number:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function _(o){let{accountAddress:n,aptosConfig:e,eventType:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},indexed_type:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function c(o){let{aptosConfig:n,options:e}=o;y(e?.where?.indexed_type?._eq);let t={query:d,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await a({aptosConfig:n,query:t,originMethod:"getEvents"})).events}export{f as a,h as b,_ as c,c as d};
|
|
2
|
+
//# sourceMappingURL=chunk-HOX6Q6ZP.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-RKHPXZM6.mjs";import{a as p}from"./chunk-JBTLE33X.mjs";var l={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(s,R){let{url:o,method:i,body:u,contentType:d,params:t,overrides:e,originMethod:n}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${p}`,"content-type":d??"application/json","x-aptos-typescript-sdk-origin-method":n};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),R.provider({url:o,method:i,body:u,params:t,headers:r,overrides:e})}async function N(s,R,o){let{url:i,path:u}=s,d=u?`${i}/${u}`:i,t=await c({...s,url:d},R.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:d};if(e.status===401)throw new a(s,e,`Error: ${e.data}`);if(o==="Indexer"){let r=e.data;if(r.errors)throw new a(s,e,`Indexer error: ${r.errors[0].message}`??`Indexer unhandled Error ${t.status} : ${t.statusText}`);e.data=r.data}else if((o==="Pepper"||o==="Prover")&&e.status>=500)throw new a(s,e,`${t.data}`);if(e.status>=200&&e.status<300)return e;let n;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?n=JSON.stringify(e.data):e.status in l?n=l[e.status]:n=`Unhandled Error ${e.status} : ${e.statusText}`,new a(s,e,`${o} error: ${n}`)}export{c as a,N as b};
|
|
2
|
+
//# sourceMappingURL=chunk-IMVC2JKU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = path ? `${url}/${path}` : url;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e API_KEY error)\n if (result.status === 401) {\n throw new AptosApiError(options, result, `Error: ${result.data}`);\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = result.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n `Indexer error: ${indexerResponse.errors[0].message}` ??\n `Indexer unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n }
|
|
1
|
+
{"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = path ? `${url}/${path}` : url;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e API_KEY error)\n if (result.status === 401) {\n throw new AptosApiError(options, result, `Error: ${result.data}`);\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = result.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n `Indexer error: ${indexerResponse.errors[0].message}` ??\n `Indexer unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (result.status >= 500) {\n throw new AptosApiError(options, result, `${response.data}`);\n }\n }\n\n if (result.status >= 200 && result.status < 300) {\n return result;\n }\n\n\n let errorMessage: string;\n\n if (result && result.data && \"message\" in result.data && \"error_code\" in result.data) {\n errorMessage = JSON.stringify(result.data);\n } else if (result.status in errors) {\n // If it's not an API type, it must come form infra, these are prehandled\n errorMessage = errors[result.status];\n } else {\n // Everything else is unhandled\n errorMessage = `Unhandled Error ${result.status} : ${result.statusText}`;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError(options, result, `${apiType} error: ${errorMessage}`);\n}\n"],"mappings":"6EAYA,IAAMA,EAAiC,CACrC,IAAK,cACL,IAAK,eACL,IAAK,YACL,IAAK,YACL,IAAK,oBACL,IAAK,wBACL,IAAK,cACL,IAAK,qBACP,EAMA,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,GAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,aAAAC,CAAa,EAAIR,EACtES,EAAoE,CACxE,GAAGF,GAAW,QACd,iBAAkB,wBAAwBG,CAAO,GACjD,eAAgBL,sBAChB,uCAAwCG,CAC1C,EAEA,OAAID,GAAW,aACbE,EAAQ,cAAgB,UAAUF,GAAW,UAAU,IAErDA,GAAW,UACbE,EAAQ,cAAgB,UAAUF,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAG,EACA,UAAAF,CACF,CAAC,CACH,CASA,eAAsBI,EACpBX,EACAY,EACAC,EACkC,CAClC,GAAM,CAAE,IAAAX,EAAK,KAAAY,CAAK,EAAId,EAChBe,EAAUD,EAAO,GAAGZ,CAAG,IAAIY,CAAI,GAAKZ,EACpCc,EAAW,MAAMjB,EAAkB,CAAE,GAAGC,EAAS,IAAKe,CAAQ,EAAGH,EAAY,MAAM,EAEnFK,EAAkC,CACtC,OAAQD,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMA,EAAS,KACf,QAASA,EAAS,QAClB,OAAQA,EAAS,OACjB,QAASA,EAAS,QAClB,IAAKD,CACP,EAGA,GAAIE,EAAO,SAAW,IACpB,MAAM,IAAIC,EAAclB,EAASiB,EAAQ,UAAUA,EAAO,IAAI,EAAE,EAKlE,GAAIJ,cAAkC,CACpC,IAAMM,EAAkBF,EAAO,KAE/B,GAAIE,EAAgB,OAClB,MAAM,IAAID,EACRlB,EACAiB,EACA,kBAAkBE,EAAgB,OAAO,CAAC,EAAE,OAAO,IACjD,2BAA2BH,EAAS,MAAM,MAAMA,EAAS,UAAU,EACvE,EAEFC,EAAO,KAAOE,EAAgB,IAChC,UAAWN,cAAmCA,eACxCI,EAAO,QAAU,IACnB,MAAM,IAAIC,EAAclB,EAASiB,EAAQ,GAAGD,EAAS,IAAI,EAAE,EAI/D,GAAIC,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAOA,EAIT,IAAIG,EAEJ,MAAIH,GAAUA,EAAO,MAAQ,YAAaA,EAAO,MAAQ,eAAgBA,EAAO,KAC9EG,EAAe,KAAK,UAAUH,EAAO,IAAI,EAChCA,EAAO,UAAUnB,EAE1BsB,EAAetB,EAAOmB,EAAO,MAAM,EAGnCG,EAAe,mBAAmBH,EAAO,MAAM,MAAMA,EAAO,UAAU,GAKlE,IAAIC,EAAclB,EAASiB,EAAQ,GAAGJ,CAAO,WAAWO,CAAY,EAAE,CAC9E","names":["errors","request","options","client","url","method","body","contentType","params","overrides","originMethod","headers","VERSION","aptosRequest","aptosConfig","apiType","path","fullUrl","response","result","AptosApiError","indexerResponse","errorMessage"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-HGRU3HWY.mjs";import{a as g,b as _}from"./chunk-RWYPGTNL.mjs";import{a as p,c as b}from"./chunk-WOLLRMXR.mjs";import{b as o}from"./chunk-WHSN42R2.mjs";import{a as h}from"./chunk-272NA6H5.mjs";var c=class extends h{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return A.load(t);case 4:return y.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},d=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=p.deserialize(e),s=b.deserialize(e);return new i(r,s)}},u=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=g.deserialize(e),s=_.deserialize(e);return new i(r,s)}},l=class i extends c{constructor(e,r,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n);return new i(r,s,a)}},A=class i extends c{constructor(e,r,s,a){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s,this.fee_payer=a}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n),z=o.deserialize(e),S=n.deserialize(e),E={address:z,authenticator:S};return new i(r,s,a,E)}},y=class i extends c{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=n.deserialize(e);return new i(r)}};export{c as a,d as b,u as c,l as d,A as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-ISXBJPLD.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-3DP4R3FI.mjs";import{b as a}from"./chunk-WHSN42R2.mjs";import{a as i}from"./chunk-272NA6H5.mjs";var o=class t extends i{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IU6REVKX.mjs.map
|