@aptos-labs/ts-sdk 1.13.3-zeta.0 → 1.13.3-zeta.2
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/index.d.ts +24 -4
- package/dist/common/index.js +11 -11
- 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 +1 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +23 -4
- 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 -1
- 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.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.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +3 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/staking.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/index.mjs +1 -1
- package/dist/esm/{chunk-TJPWYYNO.mjs → chunk-2Q6K4CLJ.mjs} +2 -2
- package/dist/esm/{chunk-R6PFLI3Z.mjs → chunk-4WMPZEJS.mjs} +2 -2
- package/dist/esm/{chunk-X56CTMYB.mjs → chunk-5QBTBH64.mjs} +2 -2
- package/dist/esm/chunk-5RBI4QWR.mjs +2 -0
- package/dist/esm/chunk-5RBI4QWR.mjs.map +1 -0
- package/dist/esm/{chunk-HURQZGUZ.mjs → chunk-6M6XXPQQ.mjs} +2 -2
- package/dist/esm/{chunk-CN37OHFT.mjs → chunk-7CW32VZG.mjs} +2 -2
- package/dist/esm/{chunk-CQJ4WN7M.mjs → chunk-7JNPSNL6.mjs} +2 -2
- package/dist/esm/{chunk-SRLCFTZR.mjs → chunk-ADQGYJZR.mjs} +2 -2
- package/dist/esm/{chunk-KCVBUZ6L.mjs → chunk-AN2KSYKO.mjs} +2 -2
- package/dist/esm/{chunk-SNQJV7MF.mjs → chunk-CQ6CHOHQ.mjs} +2 -2
- package/dist/esm/{chunk-J2IIPYZG.mjs → chunk-D2ALJ5UZ.mjs} +2 -2
- package/dist/esm/{chunk-LDMEIVL6.mjs → chunk-D63W6JYG.mjs} +2 -2
- package/dist/esm/{chunk-KNHI66FK.mjs → chunk-DLZXY6VZ.mjs} +2 -2
- package/dist/esm/chunk-DMKFITUM.mjs +2 -0
- package/dist/esm/chunk-DMKFITUM.mjs.map +1 -0
- package/dist/esm/{chunk-WO2KROQ6.mjs → chunk-EA5KB322.mjs} +2 -2
- package/dist/esm/{chunk-JEUAQVXW.mjs → chunk-EBCDMINE.mjs} +2 -2
- package/dist/esm/{chunk-U72H6EST.mjs → chunk-EI7MOA4R.mjs} +2 -2
- package/dist/esm/{chunk-6GQAHQGW.mjs → chunk-EJPL4WP3.mjs} +2 -2
- package/dist/esm/{chunk-QMIEBNTP.mjs → chunk-G4UC736K.mjs} +2 -2
- package/dist/esm/{chunk-QXVGXZJX.mjs → chunk-H6EEHYWO.mjs} +2 -2
- package/dist/esm/{chunk-LX7N4NUS.mjs → chunk-ITEV72BZ.mjs} +2 -2
- package/dist/esm/{chunk-3LQPAGL6.mjs → chunk-K4OBKJK4.mjs} +2 -2
- package/dist/esm/chunk-KAMRUIEM.mjs +2 -0
- package/dist/esm/chunk-KAMRUIEM.mjs.map +1 -0
- package/dist/esm/{chunk-F6QCHPVS.mjs → chunk-KGJITNRZ.mjs} +2 -2
- package/dist/esm/{chunk-TBG3MIIE.mjs → chunk-LRUXIKHV.mjs} +2 -2
- package/dist/esm/{chunk-Q7TGZJT4.mjs → chunk-NRJ34FML.mjs} +2 -2
- package/dist/esm/chunk-OQMR3WGU.mjs +2 -0
- package/dist/esm/chunk-OQMR3WGU.mjs.map +1 -0
- package/dist/esm/chunk-P5VCS2F5.mjs +2 -0
- package/dist/esm/chunk-P5VCS2F5.mjs.map +1 -0
- package/dist/esm/{chunk-6NZNCDDW.mjs → chunk-PFQQIEWF.mjs} +2 -2
- package/dist/esm/{chunk-H6BRBIMG.mjs → chunk-PPXY7O7X.mjs} +2 -2
- package/dist/esm/{chunk-7FNHL6LU.mjs → chunk-PTIZKRON.mjs} +2 -2
- package/dist/esm/{chunk-3PGVEOWR.mjs → chunk-PXS6QB3Q.mjs} +2 -2
- package/dist/esm/{chunk-EQKI6NJR.mjs → chunk-QNXQJBSH.mjs} +2 -2
- package/dist/esm/{chunk-7MPJPZ73.mjs → chunk-R7BAM2G6.mjs} +2 -2
- package/dist/esm/{chunk-DKLA4F3P.mjs → chunk-RROJLXZ6.mjs} +2 -2
- package/dist/esm/{chunk-AKGASNN4.mjs → chunk-RSPF5S2J.mjs} +2 -2
- package/dist/esm/{chunk-T3W5USZC.mjs → chunk-SW6IHEIE.mjs} +2 -2
- package/dist/esm/{chunk-RPXN7HGR.mjs → chunk-T75EO4EY.mjs} +2 -2
- package/dist/esm/{chunk-2SD6JLIU.mjs → chunk-TGYE266K.mjs} +2 -2
- package/dist/esm/{chunk-3CIA6J5L.mjs → chunk-TKUEWPVF.mjs} +2 -2
- package/dist/esm/{chunk-JOYJUVSE.mjs → chunk-UWRDLIBP.mjs} +2 -2
- package/dist/esm/{chunk-HFLWASAB.mjs → chunk-VFALS4YR.mjs} +2 -2
- package/dist/esm/{chunk-QHIQLTBS.mjs → chunk-VI4ZVGUW.mjs} +2 -2
- package/dist/esm/{chunk-7XHVF3ZX.mjs → chunk-VPZ4ZYJA.mjs} +2 -2
- package/dist/esm/{chunk-N4B6S6FK.mjs → chunk-W6JXUSH2.mjs} +2 -2
- package/dist/esm/chunk-WNXSPLZO.mjs +2 -0
- package/dist/esm/{chunk-YGHLXEB4.mjs.map → chunk-WNXSPLZO.mjs.map} +1 -1
- package/dist/esm/{chunk-E4Z5IEZP.mjs → chunk-WPVBC4JS.mjs} +2 -2
- package/dist/esm/{chunk-6NMHAFIO.mjs → chunk-WTVN3XGK.mjs} +2 -2
- package/dist/esm/{chunk-H3LMPXEM.mjs → chunk-X2HZPFTC.mjs} +2 -2
- package/dist/esm/{chunk-TE7AJKSU.mjs → chunk-XHPLLMR5.mjs} +2 -2
- package/dist/esm/{chunk-HQWIGPYQ.mjs → chunk-YH6UKGIX.mjs} +2 -2
- package/dist/esm/{chunk-APEBWN6Q.mjs → chunk-YHEF3FJ4.mjs} +2 -2
- package/dist/esm/{chunk-NMVZP3Q2.mjs → chunk-YKANYJTN.mjs} +2 -2
- package/dist/esm/{chunk-XEXWFQNP.mjs → chunk-Z5II77T2.mjs} +2 -2
- package/dist/esm/{chunk-E36GTDEB.mjs → chunk-ZGTJMNZG.mjs} +2 -2
- package/dist/esm/{chunk-274CXZ6R.mjs → chunk-ZXUU37PN.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- 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/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.mjs +1 -1
- package/dist/esm/index.d.mts +2 -2
- 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 +3 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/staking.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.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.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +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/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 +8 -0
- package/src/account/KeylessAccount.ts +70 -11
- package/src/api/keyless.ts +2 -1
- package/src/internal/keyless.ts +7 -4
- package/src/utils/apiEndpoints.ts +6 -6
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2M7KHFEG.mjs +0 -2
- package/dist/esm/chunk-2M7KHFEG.mjs.map +0 -1
- package/dist/esm/chunk-5VSMDXZ6.mjs +0 -2
- package/dist/esm/chunk-5VSMDXZ6.mjs.map +0 -1
- package/dist/esm/chunk-NNA5VEB2.mjs +0 -2
- package/dist/esm/chunk-NNA5VEB2.mjs.map +0 -1
- package/dist/esm/chunk-PLPCOELE.mjs +0 -2
- package/dist/esm/chunk-PLPCOELE.mjs.map +0 -1
- package/dist/esm/chunk-W76IQV5K.mjs +0 -2
- package/dist/esm/chunk-W76IQV5K.mjs.map +0 -1
- package/dist/esm/chunk-YGHLXEB4.mjs +0 -2
- /package/dist/esm/{chunk-TJPWYYNO.mjs.map → chunk-2Q6K4CLJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-R6PFLI3Z.mjs.map → chunk-4WMPZEJS.mjs.map} +0 -0
- /package/dist/esm/{chunk-X56CTMYB.mjs.map → chunk-5QBTBH64.mjs.map} +0 -0
- /package/dist/esm/{chunk-HURQZGUZ.mjs.map → chunk-6M6XXPQQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-CN37OHFT.mjs.map → chunk-7CW32VZG.mjs.map} +0 -0
- /package/dist/esm/{chunk-CQJ4WN7M.mjs.map → chunk-7JNPSNL6.mjs.map} +0 -0
- /package/dist/esm/{chunk-SRLCFTZR.mjs.map → chunk-ADQGYJZR.mjs.map} +0 -0
- /package/dist/esm/{chunk-KCVBUZ6L.mjs.map → chunk-AN2KSYKO.mjs.map} +0 -0
- /package/dist/esm/{chunk-SNQJV7MF.mjs.map → chunk-CQ6CHOHQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-J2IIPYZG.mjs.map → chunk-D2ALJ5UZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LDMEIVL6.mjs.map → chunk-D63W6JYG.mjs.map} +0 -0
- /package/dist/esm/{chunk-KNHI66FK.mjs.map → chunk-DLZXY6VZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-WO2KROQ6.mjs.map → chunk-EA5KB322.mjs.map} +0 -0
- /package/dist/esm/{chunk-JEUAQVXW.mjs.map → chunk-EBCDMINE.mjs.map} +0 -0
- /package/dist/esm/{chunk-U72H6EST.mjs.map → chunk-EI7MOA4R.mjs.map} +0 -0
- /package/dist/esm/{chunk-6GQAHQGW.mjs.map → chunk-EJPL4WP3.mjs.map} +0 -0
- /package/dist/esm/{chunk-QMIEBNTP.mjs.map → chunk-G4UC736K.mjs.map} +0 -0
- /package/dist/esm/{chunk-QXVGXZJX.mjs.map → chunk-H6EEHYWO.mjs.map} +0 -0
- /package/dist/esm/{chunk-LX7N4NUS.mjs.map → chunk-ITEV72BZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3LQPAGL6.mjs.map → chunk-K4OBKJK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-F6QCHPVS.mjs.map → chunk-KGJITNRZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-TBG3MIIE.mjs.map → chunk-LRUXIKHV.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q7TGZJT4.mjs.map → chunk-NRJ34FML.mjs.map} +0 -0
- /package/dist/esm/{chunk-6NZNCDDW.mjs.map → chunk-PFQQIEWF.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6BRBIMG.mjs.map → chunk-PPXY7O7X.mjs.map} +0 -0
- /package/dist/esm/{chunk-7FNHL6LU.mjs.map → chunk-PTIZKRON.mjs.map} +0 -0
- /package/dist/esm/{chunk-3PGVEOWR.mjs.map → chunk-PXS6QB3Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-EQKI6NJR.mjs.map → chunk-QNXQJBSH.mjs.map} +0 -0
- /package/dist/esm/{chunk-7MPJPZ73.mjs.map → chunk-R7BAM2G6.mjs.map} +0 -0
- /package/dist/esm/{chunk-DKLA4F3P.mjs.map → chunk-RROJLXZ6.mjs.map} +0 -0
- /package/dist/esm/{chunk-AKGASNN4.mjs.map → chunk-RSPF5S2J.mjs.map} +0 -0
- /package/dist/esm/{chunk-T3W5USZC.mjs.map → chunk-SW6IHEIE.mjs.map} +0 -0
- /package/dist/esm/{chunk-RPXN7HGR.mjs.map → chunk-T75EO4EY.mjs.map} +0 -0
- /package/dist/esm/{chunk-2SD6JLIU.mjs.map → chunk-TGYE266K.mjs.map} +0 -0
- /package/dist/esm/{chunk-3CIA6J5L.mjs.map → chunk-TKUEWPVF.mjs.map} +0 -0
- /package/dist/esm/{chunk-JOYJUVSE.mjs.map → chunk-UWRDLIBP.mjs.map} +0 -0
- /package/dist/esm/{chunk-HFLWASAB.mjs.map → chunk-VFALS4YR.mjs.map} +0 -0
- /package/dist/esm/{chunk-QHIQLTBS.mjs.map → chunk-VI4ZVGUW.mjs.map} +0 -0
- /package/dist/esm/{chunk-7XHVF3ZX.mjs.map → chunk-VPZ4ZYJA.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4B6S6FK.mjs.map → chunk-W6JXUSH2.mjs.map} +0 -0
- /package/dist/esm/{chunk-E4Z5IEZP.mjs.map → chunk-WPVBC4JS.mjs.map} +0 -0
- /package/dist/esm/{chunk-6NMHAFIO.mjs.map → chunk-WTVN3XGK.mjs.map} +0 -0
- /package/dist/esm/{chunk-H3LMPXEM.mjs.map → chunk-X2HZPFTC.mjs.map} +0 -0
- /package/dist/esm/{chunk-TE7AJKSU.mjs.map → chunk-XHPLLMR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-HQWIGPYQ.mjs.map → chunk-YH6UKGIX.mjs.map} +0 -0
- /package/dist/esm/{chunk-APEBWN6Q.mjs.map → chunk-YHEF3FJ4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NMVZP3Q2.mjs.map → chunk-YKANYJTN.mjs.map} +0 -0
- /package/dist/esm/{chunk-XEXWFQNP.mjs.map → chunk-Z5II77T2.mjs.map} +0 -0
- /package/dist/esm/{chunk-E36GTDEB.mjs.map → chunk-ZGTJMNZG.mjs.map} +0 -0
- /package/dist/esm/{chunk-274CXZ6R.mjs.map → chunk-ZXUU37PN.mjs.map} +0 -0
|
@@ -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/oidb}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\nimport { jwtDecode } from \"jwt-decode\";\nimport { bls12_381 as bls } from \"@noble/curves/bls12-381\";\nimport { ProjPointType } from \"@noble/curves/abstract/weierstrass\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosPepperService, postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n APTOS_BIP44_DEFAULT_DERIVATION_PATH,\n EPK_HORIZON_SECS,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n SignedGroth16Signature,\n} from \"../core\";\nimport { HexInput } from \"../types\";\nimport { Serializer } from \"../bcs\";\nimport { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchResponse, ProverResponse } from \"../types/keyless\";\n\nconst APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST = \"APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST\";\n\nfunction stringToUint8Array(str: string): Uint8Array {\n const encoder = new TextEncoder();\n return encoder.encode(str);\n}\n\nconst PINKAS_VUF_SECRET_KEY_BASE_AFFINE = bls.G2.hashToCurve(\n stringToUint8Array(\"APTOS_KEYLESS_PEPPER_PINKAS_VUF_SECRET_KEY_BASE\"),\n { DST: APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST },\n).toAffine();\n\nfunction getPepperInput(args: { jwt: string; uidKey?: string }): ProjPointType<bigint> {\n const { jwt, uidKey } = args;\n const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);\n const serializer = new Serializer();\n serializer.serializeStr(jwtPayload.iss);\n serializer.serializeStr(jwtPayload.aud);\n serializer.serializeStr(jwtPayload[uidKey || \"sub\"]);\n serializer.serializeStr(uidKey || \"sub\");\n const serial = serializer.toUint8Array();\n const msg = bls.G1.hashToCurve(serial, { DST: \"APTOS_PEPPER_SERVICE_BLS12381_VUF_DST\" }).toAffine();\n const pp = bls.G1.ProjectivePoint.fromAffine(msg);\n return pp;\n}\n\nasync function verifyPepperBase(args: {\n aptosConfig: AptosConfig;\n pepperInput: ProjPointType<bigint>;\n pepperBase: Uint8Array;\n}): Promise<boolean> {\n const { aptosConfig, pepperInput, pepperBase } = args;\n const { data: pubKeyResponse } = await getAptosPepperService<any, { vrf_public_key_hex_string: string }>({\n aptosConfig,\n path: \"vrf-pub-key\",\n originMethod: \"getPepper\",\n });\n const publicKeyFromService = bls.G2.ProjectivePoint.fromHex(pubKeyResponse.vrf_public_key_hex_string);\n return bls.verifyShortSignature(pepperBase, pepperInput, publicKeyFromService);\n}\n\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n verify?: boolean;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey, verify } = args;\n let { derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n const { data } = await postAptosPepperService<any, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n const pepperBase = Hex.fromHexInput(data.signature).toUint8Array();\n\n if (verify) {\n const pepperVerified = verifyPepperBase({ aptosConfig, pepperBase, pepperInput: getPepperInput(args) });\n if (!pepperVerified) {\n throw new Error(\"Unable to verify\");\n }\n }\n // This takes the BLS VUF H(m)^sk and transforms it into a Pinkas VUF e(H(m), g_3^sk), where g_3 is the base of the secret key (computed pseudo-randomly via hash-to-curve).\n // This gives us the freedom of either decentralizing the pepper service as a BLS-based MPC or on top of the validators, by reusing the Pinkas WVUF-based randomness infrastructure.\n const newPepperBase = bls.pairing(\n bls.G1.ProjectivePoint.fromHex(pepperBase),\n bls.G2.ProjectivePoint.fromAffine(PINKAS_VUF_SECRET_KEY_BASE_AFFINE),\n );\n\n if (derivationPath === undefined) {\n derivationPath = APTOS_BIP44_DEFAULT_DERIVATION_PATH;\n }\n const pepper = KeylessAccount.fromDerivationPath(derivationPath, bls.fields.Fp12.toBytes(newPepperBase));\n return pepper.slice(0, 31);\n}\n\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n extraFieldKey?: string;\n}): Promise<SignedGroth16Signature> {\n const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;\n const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);\n let extraField;\n if (extraFieldKey) {\n const extraFieldVal = jwtPayload[extraFieldKey];\n extraField = `\"${extraFieldKey}\":\"${extraFieldVal}\",`;\n }\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: Number(ephemeralKeyPair.expiryDateSecs),\n exp_horizon_secs: EPK_HORIZON_SECS,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n extra_field: extraFieldKey,\n uid_key: uidKey || \"sub\",\n };\n\n const { data } = await postAptosProvingService<any, 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 proof = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new SignedGroth16Signature({\n proof,\n extraField,\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 extraFieldKey?: string;\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 if (Hex.fromHexInput(pepper).toUint8Array().length !== 31) {\n throw new Error(\"Pepper needs to be 31 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":"6VASA,OAAS,aAAAA,MAAiB,aAC1B,OAAS,aAAaC,MAAW,0BAiBjC,IAAMC,EAAsC,sCAE5C,SAASC,EAAmBC,EAAyB,CAEnD,OADgB,IAAI,YAAY,EACjB,OAAOA,CAAG,CAC3B,CAEA,IAAMC,EAAoCC,EAAI,GAAG,YAC/CH,EAAmB,iDAAiD,EACpE,CAAE,IAAKD,CAAoC,CAC7C,EAAE,SAAS,EAEX,SAASK,EAAeC,EAA+D,CACrF,GAAM,CAAE,IAAAC,EAAK,OAAAC,CAAO,EAAIF,EAClBG,EAAaC,EAAqCH,CAAG,EACrDI,EAAa,IAAIC,EACvBD,EAAW,aAAaF,EAAW,GAAG,EACtCE,EAAW,aAAaF,EAAW,GAAG,EACtCE,EAAW,aAAaF,EAAWD,GAAU,KAAK,CAAC,EACnDG,EAAW,aAAaH,GAAU,KAAK,EACvC,IAAMK,EAASF,EAAW,aAAa,EACjCG,EAAMV,EAAI,GAAG,YAAYS,EAAQ,CAAE,IAAK,uCAAwC,CAAC,EAAE,SAAS,EAElG,OADWT,EAAI,GAAG,gBAAgB,WAAWU,CAAG,CAElD,CAEA,eAAeC,EAAiBT,EAIX,CACnB,GAAM,CAAE,YAAAU,EAAa,YAAAC,EAAa,WAAAC,CAAW,EAAIZ,EAC3C,CAAE,KAAMa,CAAe,EAAI,MAAMC,EAAkE,CACvG,YAAAJ,EACA,KAAM,cACN,aAAc,WAChB,CAAC,EACKK,EAAuBjB,EAAI,GAAG,gBAAgB,QAAQe,EAAe,yBAAyB,EACpG,OAAOf,EAAI,qBAAqBc,EAAYD,EAAaI,CAAoB,CAC/E,CAEA,eAAsBC,EAAUhB,EAOR,CACtB,GAAM,CAAE,YAAAU,EAAa,IAAAT,EAAK,iBAAAgB,EAAkB,OAAAf,EAAQ,OAAAgB,CAAO,EAAIlB,EAC3D,CAAE,eAAAmB,CAAe,EAAInB,EAEnBoB,EAAO,CACX,QAASnB,EACT,IAAKgB,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAe,OAAOA,EAAiB,cAAc,EACrD,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASf,CACX,EACM,CAAE,KAAAoB,CAAK,EAAI,MAAMC,EAAiD,CACtE,YAAAb,EACA,KAAM,QACN,KAAAU,EACA,aAAc,YACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACKR,EAAaS,EAAI,aAAaC,EAAK,SAAS,EAAE,aAAa,EAEjE,GAAIJ,GAEE,CADmBT,EAAiB,CAAE,YAAAC,EAAa,WAAAE,EAAY,YAAab,EAAeC,CAAI,CAAE,CAAC,EAEpG,MAAM,IAAI,MAAM,kBAAkB,EAKtC,IAAMwB,EAAgB1B,EAAI,QACxBA,EAAI,GAAG,gBAAgB,QAAQc,CAAU,EACzCd,EAAI,GAAG,gBAAgB,WAAWD,CAAiC,CACrE,EAEA,OAAIsB,IAAmB,SACrBA,EAAiBM,GAEJC,EAAe,mBAAmBP,EAAgBrB,EAAI,OAAO,KAAK,QAAQ0B,CAAa,CAAC,EACzF,MAAM,EAAG,EAAE,CAC3B,CAEA,eAAsBG,EAAS3B,EAOK,CAClC,GAAM,CAAE,YAAAU,EAAa,IAAAT,EAAK,iBAAAgB,EAAkB,OAAAW,EAAQ,OAAA1B,EAAQ,cAAA2B,CAAc,EAAI7B,EACxEG,EAAaC,EAAqCH,CAAG,EACvD6B,EACJ,GAAID,EAAe,CACjB,IAAME,EAAgB5B,EAAW0B,CAAa,EAC9CC,EAAa,IAAID,CAAa,MAAME,CAAa,IACnD,CACA,IAAMC,EAAO,CACX,QAAS/B,EACT,IAAKgB,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,cAAe,OAAOA,EAAiB,cAAc,EACrD,iBAAkBgB,EAClB,OAAQZ,EAAI,aAAaO,CAAM,EAAE,sBAAsB,EACvD,YAAaC,EACb,QAAS3B,GAAU,KACrB,EAEM,CAAE,KAAAoB,CAAK,EAAI,MAAMY,EAA6C,CAClE,YAAAxB,EACA,KAAM,QACN,KAAMsB,EACN,aAAc,WACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EAEKG,EAAcb,EAAK,MACnBc,EAAQ,IAAIC,EAAW,CAC3B,EAAGF,EAAY,EACf,EAAGA,EAAY,EACf,EAAGA,EAAY,CACjB,CAAC,EAOD,OALoB,IAAIG,EAAuB,CAC7C,MAAAF,EACA,WAAAN,EACA,wBAAyBS,EAAmB,QAAQjB,EAAK,yBAAyB,CACpF,CAAC,CAEH,CAEA,eAAsBkB,EAAqBxC,EAQf,CAC1B,GAAM,CAAE,mBAAAyC,CAAmB,EAAIzC,EAC3B,CAAE,OAAA4B,CAAO,EAAI5B,EACjB,GAAI4B,IAAW,OACbA,EAAS,MAAMZ,EAAUhB,CAAI,UACpBqB,EAAI,aAAaO,CAAM,EAAE,aAAa,EAAE,SAAW,GAC5D,MAAM,IAAI,MAAM,6BAA6B,EAG/C,IAAMc,EAAef,EAAS,CAAE,GAAG3B,EAAM,OAAA4B,CAAO,CAAC,EAC3CQ,EAAQK,EAAqBC,EAAe,MAAMA,EAItD,OAFqBhB,EAAe,gBAAgB,CAAE,GAAG1B,EAAM,MAAAoC,EAAO,OAAAR,EAAQ,mBAAAa,CAAmB,CAAC,CAGtG","names":["jwtDecode","bls","APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST","stringToUint8Array","str","PINKAS_VUF_SECRET_KEY_BASE_AFFINE","bls","getPepperInput","args","jwt","uidKey","jwtPayload","jwtDecode","serializer","Serializer","serial","msg","verifyPepperBase","aptosConfig","pepperInput","pepperBase","pubKeyResponse","getAptosPepperService","publicKeyFromService","getPepper","ephemeralKeyPair","verify","derivationPath","body","Hex","data","postAptosPepperService","newPepperBase","APTOS_BIP44_DEFAULT_DERIVATION_PATH","KeylessAccount","getProof","pepper","extraFieldKey","extraField","extraFieldVal","json","EPK_HORIZON_SECS","postAptosProvingService","proofPoints","proof","Groth16Zkp","SignedGroth16Signature","EphemeralSignature","deriveKeylessAccount","proofFetchCallback","proofPromise"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as j}from"./chunk-DMKFITUM.mjs";import{a as g,b as I}from"./chunk-2YDIOWRJ.mjs";import{d as T}from"./chunk-WPVBC4JS.mjs";import{a as E,b as x}from"./chunk-6M6XXPQQ.mjs";import{i as F,j as b,k as y,m as f,n as A,o as m}from"./chunk-WTVN3XGK.mjs";import{k as K}from"./chunk-S5HG2QUD.mjs";import{b as w}from"./chunk-T23OVRNF.mjs";import{a as S}from"./chunk-6IFMQ5AS.mjs";import{b as l}from"./chunk-TVRJ3M7B.mjs";import{b as u}from"./chunk-AOCNYMMX.mjs";import{jwtDecode as O}from"jwt-decode";import{decode as B}from"base-64";import D from"eventemitter3";function G(v){let e=v.replace(/-/g,"+").replace(/_/g,"/"),r=e+"==".substring(0,(3-e.length%3)%3);return B(r)}var s=class s{constructor(e){let{address:r,ephemeralKeyPair:t,iss:i,uidKey:a,uidVal:o,aud:c,pepper:n,proofOrFetcher:p,proofFetchCallback:h,jwt:d}=e;this.ephemeralKeyPair=t;let k=b(e);if(this.publicKey=new F(i,k),this.accountAddress=r?w.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=a,this.uidVal=o,this.aud=c,this.jwt=d,this.emitter=new D,this.proofOrPromise=p,p instanceof f)this.proof=p;else{if(h===void 0)throw new Error("Must provide callback");this.emitter.on("proofFetchFinish",async z=>{await h(z),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let P=u.fromHexInput(n).toUint8Array();if(P.length!==s.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${s.PEPPER_LENGTH}`);this.pepper=P}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),t=e.deserializeStr(),i=e.deserializeFixedBytes(31),a=j.deserialize(e),o=f.deserialize(e);return s.fromJWTAndProof({proof:o,pepper:i,uidKey:t,jwt:r,ephemeralKeyPair:a})}isExpired(){return this.ephemeralKeyPair.isExpired()}bcsToBytes(){let e=new l;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return u.fromHexInput(e)}signWithAuthenticator(e){let r=g(e),t=new x(this.sign(r.bcsToBytes())),i=new E(this.publicKey);return new T(i,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair,t=Math.floor(new Date().getTime()/1e3);if(r<t)throw new Error("Ephemeral key pair is expired.");if(this.proof===void 0)throw new Error("Proof not found");let i=this.jwt.split(".")[0],a=this.ephemeralKeyPair.getPublicKey(),o=new l;o.serializeFixedBytes(u.fromHexInput(e).toUint8Array()),o.serializeOption(this.proof.proof);let c=I(o.toUint8Array(),"APTOS::TransactionAndProof"),n=this.ephemeralKeyPair.sign(c);return new m({jwtHeader:G(i),openIdSignatureOrZkProof:new y(this.proof),expiryDateSecs:r,ephemeralPublicKey:a,ephemeralSignature:n})}signTransaction(e){let r=g(e);return this.sign(r.bcsToBytes())}signWithOpenIdSignature(e){let[r,t,i]=this.jwt.split("."),a=new A({jwtSignature:i,jwtPayloadJson:t,uidKey:this.uidKey,epkBlinder:this.ephemeralKeyPair.blinder,pepper:this.pepper}),{expiryDateSecs:o}=this.ephemeralKeyPair,c=this.ephemeralKeyPair.getPublicKey(),n=this.ephemeralKeyPair.sign(e);return new m({jwtHeader:r,openIdSignatureOrZkProof:new y(a),expiryDateSecs:o,ephemeralPublicKey:c,ephemeralSignature:n})}verifySignature(e){return!0}static fromBytes(e){return s.deserialize(new S(e))}static fromJWTAndProof(e){let{proof:r,jwt:t,ephemeralKeyPair:i,pepper:a,proofFetchCallback:o}=e,c=e.uidKey??"sub",n=O(t),p=n.iss;if(typeof n.aud!="string")throw new Error("aud was not found or an array of values");let h=n.aud,d=n[c];return new s({proofOrFetcher:r,ephemeralKeyPair:i,iss:p,uidKey:c,uidVal:d,aud:h,pepper:a,jwt:t,proofFetchCallback:o})}static fromDerivationPath(e,r){return K(e,s.SLIP_0010_SEED,r)}};s.PEPPER_LENGTH=31,s.SLIP_0010_SEED="32 bytes";var H=s;export{H as a};
|
|
2
|
+
//# sourceMappingURL=chunk-P5VCS2F5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { decode } from \"base-64\";\nimport EventEmitter from \"eventemitter3\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n OpenIdSignature,\n OpenIdSignatureOrZkProof,\n Signature,\n SignedGroth16Signature,\n computeAddressSeed,\n fromDerivationPath as fromDerivationPathInner,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializer } from \"../bcs\";\nimport { deriveTransactionType, generateSigningMessage } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\nfunction base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n\n // Decode the base64 string using the base-64 library\n const decodedString = decode(paddedBase64);\n\n return decodedString;\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n\nexport class KeylessAccount implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n static readonly SLIP_0010_SEED: string = \"32 bytes\";\n\n publicKey: KeylessPublicKey;\n\n ephemeralKeyPair: EphemeralKeyPair;\n\n uidKey: string;\n\n uidVal: string;\n\n aud: string;\n\n pepper: Uint8Array;\n\n accountAddress: AccountAddress;\n\n proof: SignedGroth16Signature | undefined;\n\n proofOrPromise: SignedGroth16Signature | Promise<SignedGroth16Signature>;\n\n signingScheme: SigningScheme;\n\n jwt: string;\n\n emitter: EventEmitter<ProofFetchEvents>;\n\n constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proofOrFetcher: SignedGroth16Signature | Promise<SignedGroth16Signature>;\n proofFetchCallback?: ProofFetchCallback\n jwt: string;\n }) {\n const { address, ephemeralKeyPair, iss, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n const addressSeed = computeAddressSeed(args);\n this.publicKey = new KeylessPublicKey(iss, addressSeed);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proofOrFetcher;\n if (proofOrFetcher instanceof SignedGroth16Signature) {\n this.proof = proofOrFetcher;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback\")\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n this.init(proofOrFetcher);\n }\n \n\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n }\n\n async init(promise: Promise<SignedGroth16Signature>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", {status: \"Success\"});\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", {status: \"Failed\", error: error.toString()});\n } else {\n this.emitter.emit(\"proofFetchFinish\", {status: \"Failed\", error: \"Unknown\"});\n }\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Connot serialize - proof undefined\")\n }\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = SignedGroth16Signature.deserialize(deserializer);\n return KeylessAccount.fromJWTAndProof({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n bcsToBytes(): Uint8Array {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n bcsToHex(): Hex {\n const bcsBytes = this.bcsToBytes();\n return Hex.fromHexInput(bcsBytes);\n }\n\n signWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const raw = deriveTransactionType(transaction);\n const signature = new AnySignature(this.sign(raw.bcsToBytes()));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n sign(data: HexInput): Signature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000);\n if (expiryDateSecs < currentTimeInSeconds) {\n throw new Error(\"Ephemeral key pair is expired.\");\n }\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n const jwtHeader = this.jwt.split(\".\")[0];\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n\n const serializer = new Serializer();\n serializer.serializeFixedBytes(Hex.fromHexInput(data).toUint8Array());\n serializer.serializeOption(this.proof.proof);\n const signMess = generateSigningMessage(serializer.toUint8Array(), \"APTOS::TransactionAndProof\");\n\n const ephemeralSignature = this.ephemeralKeyPair.sign(signMess);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(jwtHeader),\n openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(this.proof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n signTransaction(transaction: AnyRawTransaction): Signature {\n const raw = deriveTransactionType(transaction);\n return this.sign(raw.bcsToBytes());\n }\n\n signWithOpenIdSignature(data: HexInput): Signature {\n const [jwtHeader, jwtPayload, jwtSignature] = this.jwt.split(\".\");\n const openIdSig = new OpenIdSignature({\n jwtSignature,\n jwtPayloadJson: jwtPayload,\n uidKey: this.uidKey,\n epkBlinder: this.ephemeralKeyPair.blinder,\n pepper: this.pepper,\n });\n\n const { expiryDateSecs } = this.ephemeralKeyPair;\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n return new KeylessSignature({\n jwtHeader,\n openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(openIdSig),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n return true;\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(bytes));\n }\n\n static fromJWTAndProof(args: {\n proof: SignedGroth16Signature | Promise<SignedGroth16Signature>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): KeylessAccount {\n const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;\n const uidKey = args.uidKey ?? \"sub\";\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n const iss = jwtPayload.iss!;\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const aud = jwtPayload.aud!;\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n proofOrFetcher: proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n\n static fromDerivationPath(path: string, seed: Uint8Array): Uint8Array {\n return fromDerivationPathInner(path, KeylessAccount.SLIP_0010_SEED, seed);\n }\n}\n"],"mappings":"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","names":["jwtDecode","decode","EventEmitter","base64UrlDecode","base64Url","base64","paddedBase64","decode","_KeylessAccount","args","address","ephemeralKeyPair","iss","uidKey","uidVal","aud","pepper","proofOrFetcher","proofFetchCallback","jwt","addressSeed","computeAddressSeed","KeylessPublicKey","AccountAddress","EventEmitter","SignedGroth16Signature","status","pepperBytes","Hex","promise","error","serializer","deserializer","EphemeralKeyPair","proof","Serializer","bcsBytes","transaction","raw","deriveTransactionType","signature","AnySignature","publicKey","AnyPublicKey","AccountAuthenticatorSingleKey","data","expiryDateSecs","currentTimeInSeconds","jwtHeader","ephemeralPublicKey","signMess","generateSigningMessage","ephemeralSignature","KeylessSignature","OpenIdSignatureOrZkProof","jwtPayload","jwtSignature","openIdSig","OpenIdSignature","bytes","Deserializer","jwtDecode","path","seed","fromDerivationPath","KeylessAccount"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R}from"./chunk-AH44UPM4.mjs";import{h as x,i as P}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as R}from"./chunk-AH44UPM4.mjs";import{h as x,i as P}from"./chunk-YHEF3FJ4.mjs";import{b as c,d as A}from"./chunk-YKANYJTN.mjs";import{a as C}from"./chunk-6FBKUTGF.mjs";import{a as h}from"./chunk-3JPVQHOR.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-PFQQIEWF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-T75EO4EY.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PPXY7O7X.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-COW5IGYC.mjs";import{a as v}from"./chunk-STYDBDYL.mjs";import{a as u}from"./chunk-TJDC5PWD.mjs";import{f as h,l as f}from"./chunk-S5HG2QUD.mjs";import{a as g}from"./chunk-TVRJ3M7B.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-PTIZKRON.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-CQ6CHOHQ.mjs";import{a as o,b as s,c as t,d as r,e as n,f as i,h as a,i as g}from"./chunk-YHEF3FJ4.mjs";var p=class{constructor(e){this.config=e}async getLedgerInfo(){return o({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return s({aptosConfig:this.config,...e})}async getBlockByHeight(e){return t({aptosConfig:this.config,...e})}async getTableItem(e){return r({aptosConfig:this.config,...e})}async view(e){return c({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return n({aptosConfig:this.config,...e})}async queryIndexer(e){return i({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return a({aptosConfig:this.config})}async getProcessorStatus(e){return g({aptosConfig:this.config,processorType:e})}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PXS6QB3Q.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as e,g as s,h as t,i as o,j as r,k as i,l as a,m,n as c,o as g,p as u,q as p,r as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as e,g as s,h as t,i as o,j as r,k as i,l as a,m,n as c,o as g,p as u,q as p,r as d}from"./chunk-4WMPZEJS.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QNXQJBSH.mjs.map
|
|
@@ -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-7JNPSNL6.mjs";import{a as u}from"./chunk-COW5IGYC.mjs";import{a as l}from"./chunk-STYDBDYL.mjs";import{a as s}from"./chunk-6IFMQ5AS.mjs";import{b as o}from"./chunk-AOCNYMMX.mjs";var c=class i extends u{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()}toString(){return this.bcsToHex().toString()}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}isEd25519(){return this.publicKey instanceof t}},p=class i extends l{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.signature.toUint8Array()}toString(){return this.signature.toString()}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-R7BAM2G6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-ITEV72BZ.mjs";import{a as c}from"./chunk-2Q6K4CLJ.mjs";import{b as i}from"./chunk-7JNPSNL6.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RROJLXZ6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as a}from"./chunk-W6JXUSH2.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-RSPF5S2J.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t}from"./chunk-T75EO4EY.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SW6IHEIE.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-VI4ZVGUW.mjs";import{a as C}from"./chunk-H6EEHYWO.mjs";import{b as f}from"./chunk-VPZ4ZYJA.mjs";import{a as P}from"./chunk-RROJLXZ6.mjs";import{a as w}from"./chunk-YH6UKGIX.mjs";import{a as I}from"./chunk-P5VCS2F5.mjs";import{d as l}from"./chunk-2YDIOWRJ.mjs";import{a as T}from"./chunk-NC5HHEEM.mjs";import{c as A,m as s}from"./chunk-3VGX3TXH.mjs";import{b as p}from"./chunk-T23OVRNF.mjs";import{a as r}from"./chunk-EB7AI4B4.mjs";import{b as y}from"./chunk-6RBUXB5I.mjs";async function h(t){let a=await D(t);return G(t,a)}async function D(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 G(t,a){let{aptosConfig:n,sender:e,options:o}=t,i;if(K(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 K(t){return t.withFeePayer===!0}function U(t){return"secondarySignerAddresses"in t}function Y(t){let{transaction:a}=t;return l(a)}function _(t){let{signer:a,transaction:n}=t;return a.signWithAuthenticator(n)}async function $(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 nn(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 A,s.u8(),new A,s.u8(),s.u8(),s.u8()]};async function tn(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 y(n.signingScheme),r.U8(n.publicKey.toUint8Array()),new y(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,D as b,G as c,Y as d,_ as e,$ as f,B as g,M as h,nn as i,tn as j};
|
|
2
|
+
//# sourceMappingURL=chunk-T75EO4EY.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-H6EEHYWO.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TGYE266K.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as O,q as T}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as O,q as T}from"./chunk-H6EEHYWO.mjs";import{a as n}from"./chunk-VFALS4YR.mjs";import{e as o}from"./chunk-YE5B2S5L.mjs";var l=class{constructor(e){this.config=e}async getAccountInfo(e){return s({aptosConfig:this.config,...e})}async getAccountModules(e){return t({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return i({aptosConfig:this.config,...e})}async getAccountResources(e){return c({aptosConfig:this.config,...e})}async getAccountResource(e){return u({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),A({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),m({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),p({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),y({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),C({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:o,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),f({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),O({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return T({aptosConfig:this.config,...e})}};export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TKUEWPVF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-PXS6QB3Q.mjs";import{a as h}from"./chunk-KAMRUIEM.mjs";import{a as y}from"./chunk-EI7MOA4R.mjs";import{a as u}from"./chunk-ADQGYJZR.mjs";import{a as p}from"./chunk-QNXQJBSH.mjs";import{a as A}from"./chunk-EJPL4WP3.mjs";import{a as r}from"./chunk-G4UC736K.mjs";import{a}from"./chunk-7CW32VZG.mjs";import{a as c}from"./chunk-X2HZPFTC.mjs";import{a as f}from"./chunk-K4OBKJK4.mjs";import{a as g}from"./chunk-AN2KSYKO.mjs";import{a as s}from"./chunk-TKUEWPVF.mjs";var t=class{constructor(e){this.config=new A(e),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new f(this.config),this.fungibleAsset=new g(this.config),this.general=new l(this.config),this.staking=new y(this.config),this.transaction=new u(this.config),this.keyless=new h(this.config)}};function n(m,e,d){Object.getOwnPropertyNames(e.prototype).forEach(i=>{let o=Object.getOwnPropertyDescriptor(e.prototype,i);o&&(o.value=function(...w){return this[d][i](...w)},Object.defineProperty(m.prototype,i,o))})}n(t,s,"account");n(t,p,"ans");n(t,r,"coin");n(t,a,"digitalAsset");n(t,c,"event");n(t,f,"faucet");n(t,g,"fungibleAsset");n(t,l,"general");n(t,y,"staking");n(t,u,"transaction");n(t,h,"keyless");export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-UWRDLIBP.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as e}from"./chunk-PFQQIEWF.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-VFALS4YR.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D,c as Y,d as nn,e as R}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as D,c as Y,d as nn,e as R}from"./chunk-D2ALJ5UZ.mjs";import{q as Q,t as y}from"./chunk-7H3HRFVM.mjs";import{a as j}from"./chunk-H6EEHYWO.mjs";import{b as J}from"./chunk-PFQQIEWF.mjs";import{a as Z}from"./chunk-AH44UPM4.mjs";import{a as L}from"./chunk-YHEF3FJ4.mjs";import{a as z}from"./chunk-ROXFCLDT.mjs";import{g as F}from"./chunk-5RBI4QWR.mjs";import{a as X}from"./chunk-W637YAND.mjs";import{a as A}from"./chunk-5QBTBH64.mjs";import{a as H}from"./chunk-MKUAW7KW.mjs";import{a as K,c as b,d as x}from"./chunk-Z2ZR4PTF.mjs";import{c as C,d as k,e as v,f as S,g as O,h as V,i as q}from"./chunk-IEZO4PIG.mjs";import{b as E,d as p,e as l,f as B}from"./chunk-ZGTJMNZG.mjs";import{a as N,b as g,d as P}from"./chunk-WPVBC4JS.mjs";import{a as U}from"./chunk-MWUJCP27.mjs";import{b as W,c as G}from"./chunk-YE5B2S5L.mjs";import{a as _,b as $}from"./chunk-6M6XXPQQ.mjs";import{a as M,c as I}from"./chunk-7JNPSNL6.mjs";import{b as u}from"./chunk-T23OVRNF.mjs";import{b as h}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as sn}from"@noble/hashes/sha3";async function Un(n){if(Q(n))return dn(n);let{moduleAddress:t,moduleName:e,functionName:i}=y(n.function),a=await en({key:"entry-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Y});return cn({...n,abi:a})}function cn(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=y(n.function),r=D(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n.functionArguments.map((s,d)=>R(n.function,t,s,d,r));if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);let c=S.build(`${e}::${i}`,a,r,o);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new v(new V(s,new q(c)))}return new k(c)}async function Cn(n){let{moduleAddress:t,moduleName:e,functionName:i}=y(n.function),a=await en({key:"view-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:nn});return un({abi:a,...n})}function un(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=y(n.function),r=D(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n?.functionArguments?.map((c,s)=>R(n.function,t,c,s,r))??[];if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);return S.build(`${e}::${i}`,a,r,o)}function dn(n){return new C(new O(h.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function An(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=async()=>F[t.network]?{chainId:F[t.network]}:{chainId:(await L({aptosConfig:t})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await J({aptosConfig:t})).gas_estimate},s=async()=>{let f=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:(await j({aptosConfig:t,accountAddress:e})).sequence_number;if(r&&u.from(r).equals(u.ZERO))try{return await f()}catch{return 0}else return f()},[{chainId:d},{gasEstimate:m},T]=await Promise.all([o(),c(),s()]),{maxGasAmount:an,gasUnitPrice:rn,expireTimestamp:on}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(2e5),gasUnitPrice:a?.gasUnitPrice??BigInt(m),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new K(u.from(e),BigInt(T),i,BigInt(an),BigInt(rn),BigInt(on),new U(d))}async function kn(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=await An({aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new X(o,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new H(o,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function vn(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:i,feePayerPublicKey:a}=n,r=w(t);if(e.feePayerAddress){let c=new x(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),s=[];i&&(s=i.map(T=>w(T)));let d=w(a),m=new l(r,e.secondarySignerAddresses??[],s,{address:e.feePayerAddress,authenticator:d});return new A(c.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let c=new b(e.rawTransaction,e.secondarySignerAddresses),s=[];s=i.map(m=>w(m));let d=new p(r,e.secondarySignerAddresses,s);return new A(c.raw_txn,d).bcsToBytes()}let o;if(r instanceof g)o=new E(r.public_key,r.signature);else if(r instanceof P)o=new B(r);else throw new Error("Invalid public key");return new A(e.rawTransaction,o).bcsToBytes()}function w(n){return n instanceof _?new P(n,new $(new I(new Uint8Array(64)))):new g(new M(n.toUint8Array()),new I(new Uint8Array(64)))}function mn(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:i}=n,a=z(N,n.senderAuthenticator),r;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new l(a,t.secondarySignerAddresses??[],i??[],{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new p(a,t.secondarySignerAddresses,i)}else a instanceof g?r=new E(a.public_key,a.signature):r=new B(a);return new A(t.rawTransaction,r).bcsToBytes()}function tn(n){let t=sn.create();for(let e of n)t.update(e);return t.digest()}var yn=tn(["APTOS::Transaction"]);function On(n){let t=mn(n);return new h(tn([yn,new Uint8Array([0]),t])).toString()}function Vn(n,t,e,i){if(n instanceof x){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let a=new l(t,n.secondary_signer_addresses,i??[],{address:n.fee_payer_address,authenticator:e});return new A(n.raw_txn,a).bcsToBytes()}if(n instanceof b){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let a=new p(t,n.secondary_signer_addresses,i??[]);return new A(n.raw_txn,a).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}async function en({key:n,moduleAddress:t,moduleName:e,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:Z(async()=>o(t,e,i,a),`${n}-${a.network}-${t}-${e}-${i}`,1e3*60*5)()}export{Un as a,cn as b,Cn as c,un as d,An as e,kn as f,vn as g,w as h,mn as i,tn as j,On as k,Vn as l};
|
|
2
|
+
//# sourceMappingURL=chunk-VI4ZVGUW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-EA5KB322.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
|
|
2
|
+
//# sourceMappingURL=chunk-VPZ4ZYJA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l}from"./chunk-TGYE266K.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,h as d}from"./chunk-T75EO4EY.mjs";import{g as u}from"./chunk-PFQQIEWF.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,options:{timeoutSecs:3}}));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-W6JXUSH2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.13.3-zeta.
|
|
1
|
+
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.13.3-zeta.2\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as z,b as A}from"./chunk-KGJITNRZ.mjs";import{a as g,b as h}from"./chunk-6M6XXPQQ.mjs";import{a as b,b as p}from"./chunk-XHPLLMR5.mjs";import{a as d,c as y}from"./chunk-7JNPSNL6.mjs";import{a as o}from"./chunk-TVRJ3M7B.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=d.deserialize(i),r=y.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-WPVBC4JS.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g,c as w,d as K,e as B}from"./chunk-FLYEALDB.mjs";import{a as z,b as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g,c as w,d as K,e as B}from"./chunk-FLYEALDB.mjs";import{a as z,b as S}from"./chunk-R7BAM2G6.mjs";import{b as E}from"./chunk-COW5IGYC.mjs";import{a as p}from"./chunk-STYDBDYL.mjs";import{a as b}from"./chunk-7STYQ5ZE.mjs";import{a as f,b as y}from"./chunk-TVRJ3M7B.mjs";import{b as c}from"./chunk-AOCNYMMX.mjs";var P=1e7,H=120,v=30,O=330,R=120,N=350,C=300,$=93,o=class o extends E{constructor(e,t){super();let r=c.fromHexInput(t).toUint8Array();if(r.length!==o.ADDRESS_SEED_LENGTH)throw new Error(`Address seed length in bytes should be ${o.ADDRESS_SEED_LENGTH}`);this.iss=e,this.addressSeed=r}authKey(){let e=new y;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),b.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return c.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){return!0}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.addressSeed)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new o(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new o(t,r)}static isPublicKey(e){return e instanceof o}static create(e){return I(e),new o(e.iss,I(e))}};o.ADDRESS_SEED_LENGTH=32;var m=o;function I(n){let{uidKey:d,uidVal:e,aud:t,pepper:r}=n,i=[w(c.fromHexInput(r).toUint8Array()),g(t,H),g(e,O),g(d,v)];return K(B(i),m.ADDRESS_SEED_LENGTH)}var h=class n extends p{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof U)e.serializeU32AsUleb128(1),this.signature.serialize(e);else if(this.signature instanceof x)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Not a valid OIDB signature")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(x.load(e));case 1:return new n(U.load(e));default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},A=class n extends f{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=c.fromHexInput(t).toUint8Array(),this.b=c.fromHexInput(r).toUint8Array(),this.c=c.fromHexInput(i).toUint8Array()}toUint8Array(){let e=new y;return this.serialize(e),e.toUint8Array()}serialize(e){e.serializeU32AsUleb128(0),e.serializeFixedBytes(this.a),e.serializeFixedBytes(this.b),e.serializeFixedBytes(this.c)}static deserialize(e){e.deserializeUleb128AsU32();let t=e.deserializeFixedBytes(32),r=e.deserializeFixedBytes(64),i=e.deserializeFixedBytes(32);return new n({a:t,b:r,c:i})}},x=class n extends p{constructor(e){super();let{proof:t,expHorizonSecs:r=BigInt(P),trainingWheelsSignature:i,extraField:s,overrideAudVal:a}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=s,this.overrideAudVal=a}toUint8Array(){let e=new y;return this.serialize(e),e.toUint8Array()}toString(){return this.toString()}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=A.deserialize(e),r=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,l=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[u]=e.deserializeVector(S);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:u,extraField:s,overrideAudVal:l})}static load(e){let t=A.deserialize(e),r=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,l=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[u]=e.deserializeVector(S);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:u,extraField:s,overrideAudVal:l})}},U=class n extends p{constructor(e){super();let{jwtSignature:t,uidKey:r,jwtPayloadJson:i,epkBlinder:s,pepper:a,overrideAudValue:l}=e;this.jwtSignature=t,this.jwtPayloadJson=i,this.uidKey=r??"sub",this.epkBlinder=s,this.pepper=a,this.overrideAudValue=l}toUint8Array(){return this.epkBlinder}toString(){return this.toString()}serialize(e){e.serializeStr(this.jwtSignature),e.serializeStr(this.jwtPayloadJson),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.epkBlinder),e.serializeFixedBytes(this.pepper),e.serializeOptionStr(this.overrideAudValue)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),u=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:t,jwtPayloadJson:r,uidKey:i,epkBlinder:s,pepper:a,overrideAudValue:u})}static load(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),u=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:t,jwtPayloadJson:r,uidKey:i,epkBlinder:s,pepper:a,overrideAudValue:u})}static isSignature(e){return e instanceof n}},D=class n extends p{constructor(e){super();let{jwtHeader:t,openIdSignatureOrZkProof:r,expiryDateSecs:i,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=t,this.openIdSignatureOrZkProof=r,this.expiryDateSecs=i,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.ephemeralSignature.toUint8Array()}toString(){return this.toString()}serialize(e){this.openIdSignatureOrZkProof.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),r=e.deserializeStr(),i=e.deserializeU64(),s=z.deserialize(e),a=S.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:i,openIdSignatureOrZkProof:t,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let t=e.deserializeStr(),r=e.deserializeU64(),i=h.deserialize(e),s=z.deserialize(e),a=S.deserialize(e);return new n({jwtHeader:t,expiryDateSecs:r,openIdSignatureOrZkProof:i,ephemeralPublicKey:s,ephemeralSignature:a})}static isSignature(e){return e instanceof n}};export{P as a,H as b,v as c,O as d,R as e,N as f,C as g,$ as h,m as i,I as j,h as k,A as l,x as m,U as n,D as o};
|
|
2
|
+
//# sourceMappingURL=chunk-WTVN3XGK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as s}from"./chunk-DLZXY6VZ.mjs";import{a as n}from"./chunk-VFALS4YR.mjs";var i=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),o({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),r({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),t({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"events_processor"}),s({aptosConfig:this.config,...e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-X2HZPFTC.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h,c as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as h,c as l}from"./chunk-7JNPSNL6.mjs";import{b as E}from"./chunk-COW5IGYC.mjs";import{a as p}from"./chunk-STYDBDYL.mjs";import{a as g}from"./chunk-7STYQ5ZE.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
|
|
2
|
+
//# sourceMappingURL=chunk-XHPLLMR5.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-P5VCS2F5.mjs";import{e as u}from"./chunk-WPVBC4JS.mjs";import{a as o,b as r}from"./chunk-KGJITNRZ.mjs";var g=class c{constructor(t){let{multiKey:i,signers:s}=t;this.publicKey=i,this.signers=s,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let e=[];for(let n of s)e.push(this.publicKey.getIndex(n.publicKey));this.signaturesBitmap=this.publicKey.createBitmap({bits:e})}static fromPublicKeysAndSigners(t){let{publicKeys:i,signaturesRequired:s,signers:e}=t,n=new o({publicKeys:i,signaturesRequired:s});return new c({multiKey:n,signers:e})}static isMultiKeySigner(t){return t instanceof c}signWithAuthenticator(t){return new u(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(i=>i instanceof a);await Promise.all(t.filter(i=>i.proof instanceof Promise).map(i=>i.proof))}sign(t){let i=[];for(let s of this.signers)i.push(s.sign(t));return new r({signatures:i,bitmap:this.signaturesBitmap})}signTransaction(t){let i=[];for(let s of this.signers)i.push(s.signTransaction(t));return new r({signatures:i,bitmap:this.signaturesBitmap})}verifySignature(t){return!0}};export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-YH6UKGIX.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m as g,v as a}from"./chunk-S4SEFF4K.mjs";import{b as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{m as g,v as a}from"./chunk-S4SEFF4K.mjs";import{b as p,c}from"./chunk-VPZ4ZYJA.mjs";import{b as n}from"./chunk-YKANYJTN.mjs";async function h(o){let{aptosConfig:t}=o,{data:e}=await n({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function l(o){let{aptosConfig:t,ledgerVersion:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:t,blockHeight:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:t,handle:e,data:s,options:r}=o;return(await p({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:t,limit:e}=o;return(await i({aptosConfig:t,query:{query:g,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function i(o){let{aptosConfig:t,query:e,originMethod:s}=o,{data:r}=await c({aptosConfig:t,originMethod:s??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:t}=o;return(await i({aptosConfig:t,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function q(o){let t=await f({aptosConfig:o.aptosConfig});return BigInt(t[0].last_success_version)}async function b(o){let{aptosConfig:t,processorType:e}=o;return(await i({aptosConfig:t,query:{query:a,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{h as a,l as b,C as c,m as d,T as e,i as f,f as g,q as h,b as i};
|
|
2
|
+
//# sourceMappingURL=chunk-YHEF3FJ4.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-EA5KB322.mjs";async function r(e){let{aptosConfig:t,overrides:s,params:n,contentType:o,acceptType:i,path:a,originMethod:R,type:d}=e,u=t.getRequestUrl(d);return p({url:u,method:"GET",originMethod:R,path:a,contentType:o,acceptType:i,params:n,overrides:{...t.clientConfig,...s}},t,e.type)}async function m(e){let{aptosConfig:t}=e;return r({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){return r({...e,type:"Pepper"})}async function A(e){let t=[],s,n=e.params;do{let o=await r({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:n,overrides:e.overrides});s=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),n.start=s}while(s!=null);return t}export{r as a,m as b,y as c,A as d};
|
|
2
|
+
//# sourceMappingURL=chunk-YKANYJTN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as e}from"./chunk-PFQQIEWF.mjs";import{d as c}from"./chunk-VPZ4ZYJA.mjs";import{d as r}from"./chunk-YE5B2S5L.mjs";import{b as s}from"./chunk-T23OVRNF.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-Z5II77T2.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-WPVBC4JS.mjs";import{a as g,b as _}from"./chunk-XHPLLMR5.mjs";import{a as p,c as b}from"./chunk-7JNPSNL6.mjs";import{b as o}from"./chunk-T23OVRNF.mjs";import{a as h}from"./chunk-TVRJ3M7B.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-ZGTJMNZG.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-T75EO4EY.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ZXUU37PN.mjs.map
|
package/dist/esm/client/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-EA5KB322.mjs";import"../chunk-GED6IT3S.mjs";import"../chunk-ROXFCLDT.mjs";import"../chunk-6FBKUTGF.mjs";import"../chunk-5RBI4QWR.mjs";import"../chunk-WNXSPLZO.mjs";import"../chunk-YE5B2S5L.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-C3L4ETUF.mjs";import"../chunk-3FVRXELT.mjs";import"../chunk-EB7AI4B4.mjs";import"../chunk-6RBUXB5I.mjs";import"../chunk-OKRUEVF3.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-6IFMQ5AS.mjs";import"../chunk-TVRJ3M7B.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{b as aptosRequest,a as request};
|
|
2
2
|
//# sourceMappingURL=core.mjs.map
|
package/dist/esm/client/get.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-YKANYJTN.mjs";import"../chunk-EA5KB322.mjs";import"../chunk-GED6IT3S.mjs";import"../chunk-ROXFCLDT.mjs";import"../chunk-6FBKUTGF.mjs";import"../chunk-5RBI4QWR.mjs";import"../chunk-WNXSPLZO.mjs";import"../chunk-YE5B2S5L.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-C3L4ETUF.mjs";import"../chunk-3FVRXELT.mjs";import"../chunk-EB7AI4B4.mjs";import"../chunk-6RBUXB5I.mjs";import"../chunk-OKRUEVF3.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-6IFMQ5AS.mjs";import"../chunk-TVRJ3M7B.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as get,b as getAptosFullNode,c as getAptosPepperService,d as paginateWithCursor};
|
|
2
2
|
//# sourceMappingURL=get.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-N2FKVZ4D.mjs";import{a as
|
|
1
|
+
import"../chunk-N2FKVZ4D.mjs";import{a as h,b as i,c as j,d as k,e as l,f as m}from"../chunk-VPZ4ZYJA.mjs";import{a as d,b as e,c as f,d as g}from"../chunk-YKANYJTN.mjs";import{a as b,b as c}from"../chunk-EA5KB322.mjs";import"../chunk-GED6IT3S.mjs";import"../chunk-ROXFCLDT.mjs";import{a}from"../chunk-6FBKUTGF.mjs";import"../chunk-5RBI4QWR.mjs";import"../chunk-WNXSPLZO.mjs";import"../chunk-YE5B2S5L.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-C3L4ETUF.mjs";import"../chunk-3FVRXELT.mjs";import"../chunk-EB7AI4B4.mjs";import"../chunk-6RBUXB5I.mjs";import"../chunk-OKRUEVF3.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-6IFMQ5AS.mjs";import"../chunk-TVRJ3M7B.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as AptosApiError,c as aptosRequest,d as get,e as getAptosFullNode,f as getAptosPepperService,g as paginateWithCursor,h as post,k as postAptosFaucet,i as postAptosFullNode,j as postAptosIndexer,l as postAptosPepperService,m as postAptosProvingService,b as request};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/client/post.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"../chunk-VPZ4ZYJA.mjs";import"../chunk-EA5KB322.mjs";import"../chunk-GED6IT3S.mjs";import"../chunk-ROXFCLDT.mjs";import"../chunk-6FBKUTGF.mjs";import"../chunk-5RBI4QWR.mjs";import"../chunk-WNXSPLZO.mjs";import"../chunk-YE5B2S5L.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-C3L4ETUF.mjs";import"../chunk-3FVRXELT.mjs";import"../chunk-EB7AI4B4.mjs";import"../chunk-6RBUXB5I.mjs";import"../chunk-OKRUEVF3.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-6IFMQ5AS.mjs";import"../chunk-TVRJ3M7B.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as post,d as postAptosFaucet,b as postAptosFullNode,c as postAptosIndexer,e as postAptosPepperService,f as postAptosProvingService};
|
|
2
2
|
//# sourceMappingURL=post.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"../../chunk-
|
|
1
|
+
import{a,b,c}from"../../chunk-7JNPSNL6.mjs";import"../../chunk-COW5IGYC.mjs";import"../../chunk-STYDBDYL.mjs";import"../../chunk-TJDC5PWD.mjs";import"../../chunk-S5HG2QUD.mjs";import"../../chunk-7STYQ5ZE.mjs";import"../../chunk-T23OVRNF.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-C3L4ETUF.mjs";import"../../chunk-3FVRXELT.mjs";import"../../chunk-EB7AI4B4.mjs";import"../../chunk-6RBUXB5I.mjs";import"../../chunk-OKRUEVF3.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-6IFMQ5AS.mjs";import"../../chunk-TVRJ3M7B.mjs";import"../../chunk-AOCNYMMX.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{b as Ed25519PrivateKey,a as Ed25519PublicKey,c as Ed25519Signature};
|
|
2
2
|
//# sourceMappingURL=ed25519.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-R7BAM2G6.mjs";import"../../chunk-7JNPSNL6.mjs";import"../../chunk-COW5IGYC.mjs";import"../../chunk-STYDBDYL.mjs";import"../../chunk-TJDC5PWD.mjs";import"../../chunk-S5HG2QUD.mjs";import"../../chunk-7STYQ5ZE.mjs";import"../../chunk-T23OVRNF.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-C3L4ETUF.mjs";import"../../chunk-3FVRXELT.mjs";import"../../chunk-EB7AI4B4.mjs";import"../../chunk-6RBUXB5I.mjs";import"../../chunk-OKRUEVF3.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-6IFMQ5AS.mjs";import"../../chunk-TVRJ3M7B.mjs";import"../../chunk-AOCNYMMX.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-FVA2OPG4.mjs";export{a as EphemeralPublicKey,b as EphemeralSignature};
|
|
2
2
|
//# sourceMappingURL=ephemeral.mjs.map
|