@aptos-labs/ts-sdk 1.22.1 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-NYtf3uZq.d.ts → accountAddress-D9blTwwp.d.ts} +57 -15
- package/dist/common/cli/index.d.ts +22 -8
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +58 -9
- package/dist/common/index.js +28 -26
- 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.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +13 -2
- 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.mjs +1 -1
- package/dist/esm/api/account.d.mts +4 -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.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +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/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-Z4CGG42L.mjs → chunk-243IMA3Y.mjs} +2 -2
- package/dist/esm/chunk-2BJ23DXY.mjs +2 -0
- package/dist/esm/chunk-2BJ23DXY.mjs.map +1 -0
- package/dist/esm/chunk-2M45ESQN.mjs +2 -0
- package/dist/esm/{chunk-4KYQ7N3N.mjs.map → chunk-2M45ESQN.mjs.map} +1 -1
- package/dist/esm/{chunk-H6CS3BD7.mjs → chunk-2SGICMXB.mjs} +2 -2
- package/dist/esm/{chunk-3DCHEXE3.mjs → chunk-3CB53WTP.mjs} +2 -2
- package/dist/esm/{chunk-IPGKZUSA.mjs → chunk-3JFX3XDA.mjs} +2 -2
- package/dist/esm/{chunk-P43CXEO4.mjs → chunk-4FMAPHUM.mjs} +2 -2
- package/dist/esm/{chunk-UYF7AQLE.mjs → chunk-4R7FL2G2.mjs} +2 -2
- package/dist/esm/{chunk-S6H5Q2IK.mjs → chunk-4ZDOOSRJ.mjs} +2 -2
- package/dist/esm/{chunk-4GNJJZ4R.mjs → chunk-5OR2POPO.mjs} +2 -2
- package/dist/esm/{chunk-F6REP536.mjs → chunk-6WAXFWLH.mjs} +2 -2
- package/dist/esm/{chunk-W26LO3CR.mjs → chunk-72QKG5N2.mjs} +2 -2
- package/dist/esm/{chunk-VEGT6ZPK.mjs → chunk-7F7AIMGB.mjs} +2 -2
- package/dist/esm/{chunk-VQPLSJEI.mjs → chunk-B4ROOQE3.mjs} +2 -2
- package/dist/esm/chunk-B4ROOQE3.mjs.map +1 -0
- package/dist/esm/{chunk-4ARX2MGY.mjs → chunk-BDD6OBUV.mjs} +2 -2
- package/dist/esm/{chunk-7X6HZUXX.mjs → chunk-BEXHZ5XT.mjs} +2 -2
- package/dist/esm/{chunk-TY4IEDJD.mjs → chunk-BFRFAX5I.mjs} +2 -2
- package/dist/esm/{chunk-KDIPFPMS.mjs → chunk-BQ7OOQRE.mjs} +2 -2
- package/dist/esm/{chunk-6TRGVQLA.mjs → chunk-BQIT7TKM.mjs} +2 -2
- package/dist/esm/{chunk-3NPBKAPF.mjs → chunk-D6DCZULX.mjs} +2 -2
- package/dist/esm/chunk-D6QSRB4J.mjs +2 -0
- package/dist/esm/chunk-D6QSRB4J.mjs.map +1 -0
- package/dist/esm/{chunk-O7XEE7QT.mjs → chunk-DAEUQBVZ.mjs} +2 -2
- package/dist/esm/chunk-E7FWVXGX.mjs +1 -0
- package/dist/esm/{chunk-7WFKAS7T.mjs → chunk-EMFVGL2Y.mjs} +2 -2
- package/dist/esm/{chunk-VN2CRWOI.mjs → chunk-ES5Z33UX.mjs} +2 -2
- package/dist/esm/{chunk-S7G6VBUB.mjs → chunk-F435LQUS.mjs} +2 -2
- package/dist/esm/{chunk-JB5R6RGF.mjs → chunk-FAFN34ZH.mjs} +2 -2
- package/dist/esm/{chunk-NAGFCYG6.mjs → chunk-FE6CYBDF.mjs} +2 -2
- package/dist/esm/{chunk-6DDSU7HN.mjs → chunk-FRUEQTCC.mjs} +2 -2
- package/dist/esm/{chunk-SQQ2424E.mjs → chunk-FSTRZMCK.mjs} +2 -2
- package/dist/esm/{chunk-OPGMT27G.mjs → chunk-FZ3HMVKE.mjs} +2 -2
- package/dist/esm/{chunk-RFA7BIDN.mjs → chunk-GBZOWPC6.mjs} +2 -2
- package/dist/esm/{chunk-PVEPP4HR.mjs → chunk-GP3RTNYN.mjs} +2 -2
- package/dist/esm/chunk-IR6L77JS.mjs +2 -0
- package/dist/esm/chunk-IR6L77JS.mjs.map +1 -0
- package/dist/esm/{chunk-Y2H7FG2P.mjs → chunk-IUAAMX5V.mjs} +2 -2
- package/dist/esm/{chunk-I2T6BJOA.mjs → chunk-IZ7OGJBY.mjs} +2 -2
- package/dist/esm/{chunk-IPTCWBFV.mjs → chunk-J26STL4T.mjs} +2 -2
- package/dist/esm/{chunk-3VUSIKCF.mjs → chunk-J4KAYDPB.mjs} +2 -2
- package/dist/esm/chunk-J6NLU6QX.mjs +2 -0
- package/dist/esm/chunk-J6NLU6QX.mjs.map +1 -0
- package/dist/esm/{chunk-NLJVP5RP.mjs → chunk-K7OBPPSF.mjs} +2 -2
- package/dist/esm/{chunk-7RVYF5OP.mjs → chunk-L7FA4ISG.mjs} +2 -2
- package/dist/esm/{chunk-7HS4UJGE.mjs → chunk-MA7TL5VN.mjs} +2 -2
- package/dist/esm/{chunk-IN2L5ZAT.mjs → chunk-ME2PENQD.mjs} +2 -2
- package/dist/esm/{chunk-463B3NF7.mjs → chunk-MG3T24A3.mjs} +2 -2
- package/dist/esm/{chunk-T4NXIMZL.mjs → chunk-NC3KKAAK.mjs} +2 -2
- package/dist/esm/chunk-NECL5FCQ.mjs +1 -0
- package/dist/esm/chunk-NECL5FCQ.mjs.map +1 -0
- package/dist/esm/{chunk-T7YRD4PM.mjs → chunk-NJ2IXXY2.mjs} +2 -2
- package/dist/esm/{chunk-43IKKJ2Y.mjs → chunk-OBKVMO7I.mjs} +2 -2
- package/dist/esm/{chunk-SK2HTEP7.mjs → chunk-ODYVU346.mjs} +2 -2
- package/dist/esm/{chunk-UJYWEIQ2.mjs → chunk-OID45FCB.mjs} +2 -2
- package/dist/esm/{chunk-GWH34VNI.mjs → chunk-OUAQKVIC.mjs} +2 -2
- package/dist/esm/{chunk-C2IJG37E.mjs → chunk-PDOQLTXA.mjs} +2 -2
- package/dist/esm/chunk-PF54PEHF.mjs +2 -0
- package/dist/esm/chunk-PF54PEHF.mjs.map +1 -0
- package/dist/esm/{chunk-GCPWPGCS.mjs → chunk-PIUICROW.mjs} +2 -2
- package/dist/esm/{chunk-TWRYY6DD.mjs → chunk-QLKTSSVC.mjs} +2 -2
- package/dist/esm/chunk-QUMSKIYX.mjs +2 -0
- package/dist/esm/{chunk-CUSKA6RZ.mjs.map → chunk-QUMSKIYX.mjs.map} +1 -1
- package/dist/esm/{chunk-LBU3LV7I.mjs → chunk-RBIJJSGB.mjs} +2 -2
- package/dist/esm/{chunk-7CMCN6LB.mjs → chunk-RZKLIZ2D.mjs} +2 -2
- package/dist/esm/chunk-T52HPGL5.mjs +2 -0
- package/dist/esm/chunk-T52HPGL5.mjs.map +1 -0
- package/dist/esm/{chunk-OVG4SGPI.mjs → chunk-T7MGIHWV.mjs} +2 -2
- package/dist/esm/{chunk-LTMOMXPN.mjs → chunk-T7WBGP37.mjs} +2 -2
- package/dist/esm/{chunk-LTMOMXPN.mjs.map → chunk-T7WBGP37.mjs.map} +1 -1
- package/dist/esm/chunk-TDGQGILY.mjs +2 -0
- package/dist/esm/chunk-TDGQGILY.mjs.map +1 -0
- package/dist/esm/{chunk-CPCS5KIA.mjs → chunk-UY4EIN3P.mjs} +2 -2
- package/dist/esm/{chunk-H6QWMF3Q.mjs → chunk-V3NKDUY5.mjs} +2 -2
- package/dist/esm/{chunk-L6RINMT6.mjs → chunk-VA4HKHNV.mjs} +2 -2
- package/dist/esm/{chunk-YMFEA2TJ.mjs → chunk-VHNX2NUR.mjs} +3 -1
- package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
- package/dist/esm/{chunk-77NXCSLY.mjs → chunk-WPYVWZQS.mjs} +2 -2
- package/dist/esm/{chunk-BF46IXHH.mjs → chunk-WSE653RS.mjs} +2 -2
- package/dist/esm/chunk-WSE653RS.mjs.map +1 -0
- package/dist/esm/{chunk-TCEOTADF.mjs → chunk-X2QSDREG.mjs} +2 -2
- package/dist/esm/{chunk-J5KAD2RM.mjs → chunk-Y5AY3QBY.mjs} +2 -2
- package/dist/esm/chunk-Y5VJSCVY.mjs +2 -0
- package/dist/esm/chunk-Y5VJSCVY.mjs.map +1 -0
- package/dist/esm/{chunk-J5YHMYHB.mjs → chunk-YEISKUKC.mjs} +2 -2
- package/dist/esm/{chunk-ZL4JYTID.mjs → chunk-ZE2TCKUL.mjs} +2 -2
- package/dist/esm/{chunk-LBKYNX5K.mjs → chunk-ZHNCJSXO.mjs} +2 -2
- package/dist/esm/{chunk-V5COHBA4.mjs → chunk-ZKCSQAGW.mjs} +2 -2
- package/dist/esm/{chunk-YDXU6ALO.mjs → chunk-ZMFVKUFD.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +21 -7
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.d.mts +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/client/types.d.mts +8 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.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.d.mts +3 -3
- 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/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +2 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +17 -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.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.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/types/generated/operations.d.mts +16 -12
- package/dist/esm/types/generated/queries.d.mts +2 -2
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.d.mts +365 -761
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +42 -3
- package/dist/esm/types/index.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 +2 -1
- package/src/account/KeylessAccount.ts +20 -4
- package/src/api/account.ts +4 -1
- package/src/client/core.ts +25 -52
- package/src/client/types.ts +60 -7
- package/src/core/accountAddress.ts +2 -0
- package/src/core/crypto/ephemeral.ts +1 -1
- package/src/internal/account.ts +35 -4
- package/src/internal/ans.ts +36 -4
- package/src/internal/queries/ansTokenFragment.graphql +2 -0
- package/src/types/generated/operations.ts +16 -12
- package/src/types/generated/queries.ts +2 -0
- package/src/types/generated/types.ts +387 -835
- package/src/types/index.ts +48 -1
- package/src/version.ts +1 -1
- package/dist/esm/chunk-4KYQ7N3N.mjs +0 -2
- package/dist/esm/chunk-5M235PLS.mjs +0 -2
- package/dist/esm/chunk-5M235PLS.mjs.map +0 -1
- package/dist/esm/chunk-67BD7B6N.mjs +0 -2
- package/dist/esm/chunk-67BD7B6N.mjs.map +0 -1
- package/dist/esm/chunk-BF46IXHH.mjs.map +0 -1
- package/dist/esm/chunk-CUSKA6RZ.mjs +0 -2
- package/dist/esm/chunk-GHYE26Q5.mjs +0 -2
- package/dist/esm/chunk-GHYE26Q5.mjs.map +0 -1
- package/dist/esm/chunk-PY23BQ2H.mjs +0 -2
- package/dist/esm/chunk-PY23BQ2H.mjs.map +0 -1
- package/dist/esm/chunk-Q6LFIZ3L.mjs +0 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +0 -1
- package/dist/esm/chunk-Q7ZP25NJ.mjs +0 -2
- package/dist/esm/chunk-Q7ZP25NJ.mjs.map +0 -1
- package/dist/esm/chunk-RFSO3JRG.mjs +0 -1
- package/dist/esm/chunk-TZOKV22Z.mjs +0 -2
- package/dist/esm/chunk-TZOKV22Z.mjs.map +0 -1
- package/dist/esm/chunk-VQPLSJEI.mjs.map +0 -1
- package/dist/esm/chunk-XVWNPR4T.mjs +0 -2
- package/dist/esm/chunk-XVWNPR4T.mjs.map +0 -1
- package/dist/esm/chunk-YMFEA2TJ.mjs.map +0 -1
- /package/dist/esm/{chunk-Z4CGG42L.mjs.map → chunk-243IMA3Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6CS3BD7.mjs.map → chunk-2SGICMXB.mjs.map} +0 -0
- /package/dist/esm/{chunk-3DCHEXE3.mjs.map → chunk-3CB53WTP.mjs.map} +0 -0
- /package/dist/esm/{chunk-IPGKZUSA.mjs.map → chunk-3JFX3XDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-P43CXEO4.mjs.map → chunk-4FMAPHUM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UYF7AQLE.mjs.map → chunk-4R7FL2G2.mjs.map} +0 -0
- /package/dist/esm/{chunk-S6H5Q2IK.mjs.map → chunk-4ZDOOSRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-4GNJJZ4R.mjs.map → chunk-5OR2POPO.mjs.map} +0 -0
- /package/dist/esm/{chunk-F6REP536.mjs.map → chunk-6WAXFWLH.mjs.map} +0 -0
- /package/dist/esm/{chunk-W26LO3CR.mjs.map → chunk-72QKG5N2.mjs.map} +0 -0
- /package/dist/esm/{chunk-VEGT6ZPK.mjs.map → chunk-7F7AIMGB.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ARX2MGY.mjs.map → chunk-BDD6OBUV.mjs.map} +0 -0
- /package/dist/esm/{chunk-7X6HZUXX.mjs.map → chunk-BEXHZ5XT.mjs.map} +0 -0
- /package/dist/esm/{chunk-TY4IEDJD.mjs.map → chunk-BFRFAX5I.mjs.map} +0 -0
- /package/dist/esm/{chunk-KDIPFPMS.mjs.map → chunk-BQ7OOQRE.mjs.map} +0 -0
- /package/dist/esm/{chunk-6TRGVQLA.mjs.map → chunk-BQIT7TKM.mjs.map} +0 -0
- /package/dist/esm/{chunk-3NPBKAPF.mjs.map → chunk-D6DCZULX.mjs.map} +0 -0
- /package/dist/esm/{chunk-O7XEE7QT.mjs.map → chunk-DAEUQBVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-RFSO3JRG.mjs.map → chunk-E7FWVXGX.mjs.map} +0 -0
- /package/dist/esm/{chunk-7WFKAS7T.mjs.map → chunk-EMFVGL2Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-VN2CRWOI.mjs.map → chunk-ES5Z33UX.mjs.map} +0 -0
- /package/dist/esm/{chunk-S7G6VBUB.mjs.map → chunk-F435LQUS.mjs.map} +0 -0
- /package/dist/esm/{chunk-JB5R6RGF.mjs.map → chunk-FAFN34ZH.mjs.map} +0 -0
- /package/dist/esm/{chunk-NAGFCYG6.mjs.map → chunk-FE6CYBDF.mjs.map} +0 -0
- /package/dist/esm/{chunk-6DDSU7HN.mjs.map → chunk-FRUEQTCC.mjs.map} +0 -0
- /package/dist/esm/{chunk-SQQ2424E.mjs.map → chunk-FSTRZMCK.mjs.map} +0 -0
- /package/dist/esm/{chunk-OPGMT27G.mjs.map → chunk-FZ3HMVKE.mjs.map} +0 -0
- /package/dist/esm/{chunk-RFA7BIDN.mjs.map → chunk-GBZOWPC6.mjs.map} +0 -0
- /package/dist/esm/{chunk-PVEPP4HR.mjs.map → chunk-GP3RTNYN.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y2H7FG2P.mjs.map → chunk-IUAAMX5V.mjs.map} +0 -0
- /package/dist/esm/{chunk-I2T6BJOA.mjs.map → chunk-IZ7OGJBY.mjs.map} +0 -0
- /package/dist/esm/{chunk-IPTCWBFV.mjs.map → chunk-J26STL4T.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VUSIKCF.mjs.map → chunk-J4KAYDPB.mjs.map} +0 -0
- /package/dist/esm/{chunk-NLJVP5RP.mjs.map → chunk-K7OBPPSF.mjs.map} +0 -0
- /package/dist/esm/{chunk-7RVYF5OP.mjs.map → chunk-L7FA4ISG.mjs.map} +0 -0
- /package/dist/esm/{chunk-7HS4UJGE.mjs.map → chunk-MA7TL5VN.mjs.map} +0 -0
- /package/dist/esm/{chunk-IN2L5ZAT.mjs.map → chunk-ME2PENQD.mjs.map} +0 -0
- /package/dist/esm/{chunk-463B3NF7.mjs.map → chunk-MG3T24A3.mjs.map} +0 -0
- /package/dist/esm/{chunk-T4NXIMZL.mjs.map → chunk-NC3KKAAK.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7YRD4PM.mjs.map → chunk-NJ2IXXY2.mjs.map} +0 -0
- /package/dist/esm/{chunk-43IKKJ2Y.mjs.map → chunk-OBKVMO7I.mjs.map} +0 -0
- /package/dist/esm/{chunk-SK2HTEP7.mjs.map → chunk-ODYVU346.mjs.map} +0 -0
- /package/dist/esm/{chunk-UJYWEIQ2.mjs.map → chunk-OID45FCB.mjs.map} +0 -0
- /package/dist/esm/{chunk-GWH34VNI.mjs.map → chunk-OUAQKVIC.mjs.map} +0 -0
- /package/dist/esm/{chunk-C2IJG37E.mjs.map → chunk-PDOQLTXA.mjs.map} +0 -0
- /package/dist/esm/{chunk-GCPWPGCS.mjs.map → chunk-PIUICROW.mjs.map} +0 -0
- /package/dist/esm/{chunk-TWRYY6DD.mjs.map → chunk-QLKTSSVC.mjs.map} +0 -0
- /package/dist/esm/{chunk-LBU3LV7I.mjs.map → chunk-RBIJJSGB.mjs.map} +0 -0
- /package/dist/esm/{chunk-7CMCN6LB.mjs.map → chunk-RZKLIZ2D.mjs.map} +0 -0
- /package/dist/esm/{chunk-OVG4SGPI.mjs.map → chunk-T7MGIHWV.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPCS5KIA.mjs.map → chunk-UY4EIN3P.mjs.map} +0 -0
- /package/dist/esm/{chunk-H6QWMF3Q.mjs.map → chunk-V3NKDUY5.mjs.map} +0 -0
- /package/dist/esm/{chunk-L6RINMT6.mjs.map → chunk-VA4HKHNV.mjs.map} +0 -0
- /package/dist/esm/{chunk-77NXCSLY.mjs.map → chunk-WPYVWZQS.mjs.map} +0 -0
- /package/dist/esm/{chunk-TCEOTADF.mjs.map → chunk-X2QSDREG.mjs.map} +0 -0
- /package/dist/esm/{chunk-J5KAD2RM.mjs.map → chunk-Y5AY3QBY.mjs.map} +0 -0
- /package/dist/esm/{chunk-J5YHMYHB.mjs.map → chunk-YEISKUKC.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZL4JYTID.mjs.map → chunk-ZE2TCKUL.mjs.map} +0 -0
- /package/dist/esm/{chunk-LBKYNX5K.mjs.map → chunk-ZHNCJSXO.mjs.map} +0 -0
- /package/dist/esm/{chunk-V5COHBA4.mjs.map → chunk-ZKCSQAGW.mjs.map} +0 -0
- /package/dist/esm/{chunk-YDXU6ALO.mjs.map → chunk-ZMFVKUFD.mjs.map} +0 -0
package/src/types/index.ts
CHANGED
|
@@ -348,6 +348,7 @@ export enum TransactionResponseType {
|
|
|
348
348
|
BlockMetadata = "block_metadata_transaction",
|
|
349
349
|
StateCheckpoint = "state_checkpoint_transaction",
|
|
350
350
|
Validator = "validator_transaction",
|
|
351
|
+
BlockEpilogue = "block_epilogue_transaction",
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;
|
|
@@ -356,7 +357,8 @@ export type CommittedTransactionResponse =
|
|
|
356
357
|
| GenesisTransactionResponse
|
|
357
358
|
| BlockMetadataTransactionResponse
|
|
358
359
|
| StateCheckpointTransactionResponse
|
|
359
|
-
| ValidatorTransactionResponse
|
|
360
|
+
| ValidatorTransactionResponse
|
|
361
|
+
| BlockEpilogueTransactionResponse;
|
|
360
362
|
|
|
361
363
|
export function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {
|
|
362
364
|
return response.type === TransactionResponseType.Pending;
|
|
@@ -388,6 +390,12 @@ export function isValidatorTransactionResponse(
|
|
|
388
390
|
return response.type === TransactionResponseType.Validator;
|
|
389
391
|
}
|
|
390
392
|
|
|
393
|
+
export function isBlockEpilogueTransactionResponse(
|
|
394
|
+
response: TransactionResponse,
|
|
395
|
+
): response is BlockEpilogueTransactionResponse {
|
|
396
|
+
return response.type === TransactionResponseType.BlockEpilogue;
|
|
397
|
+
}
|
|
398
|
+
|
|
391
399
|
export type PendingTransactionResponse = {
|
|
392
400
|
type: TransactionResponseType.Pending;
|
|
393
401
|
hash: string;
|
|
@@ -555,6 +563,45 @@ export type ValidatorTransactionResponse = {
|
|
|
555
563
|
timestamp: string;
|
|
556
564
|
};
|
|
557
565
|
|
|
566
|
+
/**
|
|
567
|
+
* BlockEndInfo describes the gas state of the block
|
|
568
|
+
*/
|
|
569
|
+
export type BlockEndInfo = {
|
|
570
|
+
block_gas_limit_reached: boolean;
|
|
571
|
+
block_output_limit_reached: boolean;
|
|
572
|
+
block_effective_block_gas_units: number;
|
|
573
|
+
block_approx_output_size: number;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* BlockEpilogueTransactionResponse is a transaction that is executed at the end of a block keeping track of data from
|
|
578
|
+
* the whole block
|
|
579
|
+
*/
|
|
580
|
+
export type BlockEpilogueTransactionResponse = {
|
|
581
|
+
type: TransactionResponseType.BlockEpilogue;
|
|
582
|
+
version: string;
|
|
583
|
+
hash: string;
|
|
584
|
+
state_change_hash: string;
|
|
585
|
+
event_root_hash: string;
|
|
586
|
+
state_checkpoint_hash: string | null;
|
|
587
|
+
gas_used: string;
|
|
588
|
+
/**
|
|
589
|
+
* Whether the transaction was successful
|
|
590
|
+
*/
|
|
591
|
+
success: boolean;
|
|
592
|
+
/**
|
|
593
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
594
|
+
*/
|
|
595
|
+
vm_status: string;
|
|
596
|
+
accumulator_root_hash: string;
|
|
597
|
+
/**
|
|
598
|
+
* Final state of resources changed by the transaction
|
|
599
|
+
*/
|
|
600
|
+
changes: Array<WriteSetChange>;
|
|
601
|
+
timestamp: string;
|
|
602
|
+
block_end_info: BlockEndInfo | null;
|
|
603
|
+
};
|
|
604
|
+
|
|
558
605
|
/**
|
|
559
606
|
* WRITESET CHANGE TYPES
|
|
560
607
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{spawn as n}from"child_process";import{platform as p}from"os";var i=class{async init(s){let{network:e,profile:r}=s,t=["aptos","init",`--network=${e??"local"}`,`--profile=${r??"default"}`];return this.runCommand(t)}async compile(s){let{packageDirectoryPath:e,namedAddresses:r}=s,t=["aptos","move","compile","--package-dir",e],a=this.parseNamedAddresses(r);return t.push(...this.prepareNamedAddresses(a)),this.runCommand(t)}async test(s){let{packageDirectoryPath:e,namedAddresses:r}=s,t=["aptos","move","test","--package-dir",e],a=this.parseNamedAddresses(r);return t.push(...this.prepareNamedAddresses(a)),this.runCommand(t)}async publish(s){let{packageDirectoryPath:e,namedAddresses:r,profile:t}=s,a=["aptos","move","publish","--package-dir",e,`--profile=${t??"default"}`],d=this.parseNamedAddresses(r);return a.push(...this.prepareNamedAddresses(d)),this.runCommand(a)}async createObjectAndPublishPackage(s){let{packageDirectoryPath:e,addressName:r,namedAddresses:t,profile:a}=s,d=["aptos","move","create-object-and-publish-package","--package-dir",e,"--address-name",r,`--profile=${a??"default"}`],o=this.parseNamedAddresses(t);return d.push(...this.prepareNamedAddresses(o)),this.runCommand(d).then(c=>this.extractAddressFromOutput(c))}async upgradeObjectPackage(s){let{packageDirectoryPath:e,objectAddress:r,namedAddresses:t,profile:a}=s,d=["aptos","move","upgrade-object-package","--package-dir",e,"--object-address",r,`--profile=${a??"default"}`],o=this.parseNamedAddresses(t);return d.push(...this.prepareNamedAddresses(o)),this.runCommand(d)}async runScript(s){let{compiledScriptPath:e,profile:r}=s,t=["aptos","move","run-script","--compiled-script-path",e,`--profile=${r??"default"}`];return this.runCommand(t)}async runCommand(s){return new Promise((e,r)=>{let t=p(),a,d="";t==="win32"?a=n("npx",s,{shell:!0}):a=n("npx",s),a.stdout.on("data",o=>{d+=o.toString()}),a.stdout.pipe(process.stdout),a.stderr.pipe(process.stderr),process.stdin.pipe(a.stdin),a.on("close",o=>{o===0?e(d):r(new Error(`Child process exited with code ${o}`))})})}prepareNamedAddresses(s){let e=s.size,r=[];if(e===0)return r;r.push("--named-addresses");let t=[];return s.forEach((a,d)=>{let o=`${d}=${a.toString()}`;t.push(o)}),r.push(t.join(",")),r}parseNamedAddresses(s){let e=new Map;return Object.keys(s).forEach(r=>{let t=s[r];e.set(r,t)}),e}extractAddressFromOutput(s){let e=s.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)\\.");if(e)return e[1];throw new Error("Failed to extract object address from output")}};export{i as a};
|
|
2
|
-
//# sourceMappingURL=chunk-5M235PLS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/move.ts"],"sourcesContent":["import { spawn } from \"child_process\";\nimport { platform } from \"os\";\n\nimport { AccountAddress } from \"../core\";\nimport { Network } from \"../utils\";\n\nexport class Move {\n /**\n * Function to initialize current directory for Aptos\n *\n * Configuration will be pushed into .aptos/config.yaml\n * @param args.network optional Network type argument to use for default settings, default is local\n * @param args.profile optional Profile to use from the config file, default is 'default'\n * This will be used to override associated settings such as the REST URL, the Faucet URL, and the private key arguments.\n *\n * @returns stdout\n */\n async init(args: { network?: Network; profile?: string }): Promise<string> {\n const { network, profile } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to compile a package\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n *\n * @returns stdout\n */\n async compile(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n }): Promise<string> {\n const { packageDirectoryPath, namedAddresses } = args;\n const cliArgs = [\"aptos\", \"move\", \"compile\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to run Move unit tests for a package\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n *\n * @returns stdout\n */\n async test(args: { packageDirectoryPath: string; namedAddresses: Record<string, AccountAddress> }): Promise<string> {\n const { packageDirectoryPath, namedAddresses } = args;\n const cliArgs = [\"aptos\", \"move\", \"test\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to publish the modules to the publisher account on the Aptos blockchain\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n *\n * @returns stdout\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n }): Promise<string> {\n const { packageDirectoryPath, namedAddresses, profile } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"publish\",\n \"--package-dir\",\n packageDirectoryPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to create a new object and publish the Move package to it on the Aptos blockchain\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.addressName Address name for the Move package\n * @example\n * MoonCoin, please find the actual address name in Move.toml\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n *\n * A complete example in cli\n * aptos move create-object-and-publish-package \\\n * --package-dir path_to_directory_that_has_move.toml \\\n * --address-name launchpad_addr \\\n * --named-addresses \"launchpad_addr=0x123,initial_creator_addr=0x456\"\\\n * --profile my_profile \\\n * --assume-yes\n * @returns object address\n */\n async createObjectAndPublishPackage(args: {\n packageDirectoryPath: string;\n addressName: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n }): Promise<string> {\n const { packageDirectoryPath, addressName, namedAddresses, profile } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"create-object-and-publish-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--address-name\",\n addressName,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n return this.runCommand(cliArgs).then((output) => this.extractAddressFromOutput(output));\n }\n\n /**\n * Function to upgrade a Move package previously published to an object on the Aptos blockchain\n * Caller must be the object owner to call this function\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.objectAddress Address of the object that the Move package published to\n * @example\n * 0x1000\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.profile optional Profile to use from the config file.\n *\n * @returns stdout\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n }): Promise<string> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"upgrade-object-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--object-address\",\n objectAddress,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Function to run a Move script, please run compile before running this\n *\n * @param args.compiledScriptPath Path to a compiled Move script bytecode file\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * build/my_package/bytecode_scripts/my_move_script.mv\n * @param args.profile optional Profile to use from the config file.\n *\n * @returns stdout\n */\n async runScript(args: { compiledScriptPath: string; profile?: string }): Promise<string> {\n const { compiledScriptPath, profile } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Run a move command\n *\n * @param args\n * @returns stdout\n */\n // eslint-disable-next-line class-methods-use-this\n private async runCommand(args: Array<string>): Promise<string> {\n return new Promise((resolve, reject) => {\n const currentPlatform = platform();\n let childProcess;\n let stdout = \"\";\n\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(\"npx\", args, { shell: true });\n } else {\n childProcess = spawn(\"npx\", args);\n }\n\n childProcess.stdout.on(\"data\", (data) => {\n stdout += data.toString();\n });\n\n childProcess.stdout.pipe(process.stdout);\n childProcess.stderr.pipe(process.stderr);\n process.stdin.pipe(childProcess.stdin);\n\n childProcess.on(\"close\", (code) => {\n if (code === 0) {\n resolve(stdout); // Resolve with stdout if the child process exits successfully\n } else {\n reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code\n }\n });\n });\n }\n\n /**\n * Convert named addresses from a Map into an array seperated by a comma\n *\n * @example\n * input: {'alice' => '0x123', 'bob' => '0x456'}\n * output: \"alice=0x123,bob=0x456\"\n *\n * @param namedAddresses\n * @returns An array of names addresses seperated by a comma\n */\n // eslint-disable-next-line class-methods-use-this\n private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {\n const totalNames = namedAddresses.size;\n const newArgs: Array<string> = [];\n\n if (totalNames === 0) {\n return newArgs;\n }\n\n newArgs.push(\"--named-addresses\");\n\n const names: Array<string> = [];\n namedAddresses.forEach((value, key) => {\n const toAppend = `${key}=${value.toString()}`;\n names.push(toAppend);\n });\n newArgs.push(names.join(\",\"));\n return newArgs;\n }\n\n /**\n * Parse named addresses from a Record type into a Map\n *\n * @param namedAddresses\n * @returns Map<name,address>\n */\n // eslint-disable-next-line class-methods-use-this\n private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {\n const addressesMap = new Map();\n\n Object.keys(namedAddresses).forEach((key) => {\n const address = namedAddresses[key];\n addressesMap.set(key, address);\n });\n\n return addressesMap;\n }\n\n /**\n * Extract object address from the output\n *\n * @param output\n * @returns object address\n */\n private extractAddressFromOutput(output: string): string {\n const match = output.match(\"Code was successfully deployed to object address (0x[0-9a-fA-F]+)\\\\.\");\n if (match) {\n return match[1];\n }\n throw new Error(\"Failed to extract object address from output\");\n }\n}\n"],"mappings":"AAAA,OAAS,SAAAA,MAAa,gBACtB,OAAS,YAAAC,MAAgB,KAKlB,IAAMC,EAAN,KAAW,CAWhB,MAAM,KAAKC,EAAgE,CACzE,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAIF,EACvBG,EAAU,CAAC,QAAS,OAAQ,aAAaF,GAAW,OAAO,GAAI,aAAaC,GAAW,SAAS,EAAE,EAExG,OAAO,KAAK,WAAWC,CAAO,CAChC,CAcA,MAAM,QAAQH,EAGM,CAClB,GAAM,CAAE,qBAAAI,EAAsB,eAAAC,CAAe,EAAIL,EAC3CG,EAAU,CAAC,QAAS,OAAQ,UAAW,gBAAiBC,CAAoB,EAE5EE,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC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IAEzB,cAAO,KAAKD,CAAc,EAAE,QAASiB,GAAQ,CAC3C,IAAME,EAAUnB,EAAeiB,CAAG,EAClChB,EAAa,IAAIgB,EAAKE,CAAO,CAC/B,CAAC,EAEMlB,CACT,CAQQ,yBAAyBE,EAAwB,CACvD,IAAMiB,EAAQjB,EAAO,MAAM,sEAAsE,EACjG,GAAIiB,EACF,OAAOA,EAAM,CAAC,EAEhB,MAAM,IAAI,MAAM,8CAA8C,CAChE,CACF","names":["spawn","platform","Move","args","network","profile","cliArgs","packageDirectoryPath","namedAddresses","addressesMap","addressName","output","objectAddress","compiledScriptPath","resolve","reject","currentPlatform","childProcess","stdout","data","code","totalNames","newArgs","names","value","key","toAppend","address","match"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as t,c as n}from"./chunk-F6REP536.mjs";import{a as u}from"./chunk-MLDQ2TY2.mjs";import{a as l}from"./chunk-76OH2Z4Q.mjs";import{a as s}from"./chunk-DZXM2MQY.mjs";import{b as o}from"./chunk-BCUSI3N6.mjs";var c=class i extends l{constructor(e){super();let r=e.constructor.name;switch(r){case t.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:a}=e;return this.publicKey.verifySignature({message:r,signature:a})}serialize(e){if(this.publicKey instanceof t)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(t.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof i}},p=class i extends u{constructor(e){super();let r=e.constructor.name;switch(r){case n.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=o.fromHexInput(e),a=new s(r.toUint8Array());return i.deserialize(a)}serialize(e){if(this.signature instanceof n)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new i(n.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};export{c as a,p as b};
|
|
2
|
-
//# sourceMappingURL=chunk-67BD7B6N.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/ephemeral.ts"],"sourcesContent":["import { Serializer, Deserializer } from \"../../bcs\";\nimport { EphemeralPublicKeyVariant, EphemeralSignatureVariant, HexInput } from \"../../types\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\n\n/**\n * Represents ephemeral public keys for Aptos Keyless accounts.\n *\n * These are not public keys used as a public key on an account. They are only used ephemerally on Keyless accounts.\n */\nexport class EphemeralPublicKey extends PublicKey {\n /**\n * The public key itself\n */\n public readonly publicKey: PublicKey;\n\n /**\n * An enum indicating the scheme of the ephemeral public key\n */\n public readonly variant: EphemeralPublicKeyVariant;\n\n constructor(publicKey: PublicKey) {\n super();\n const publicKeyType = publicKey.constructor.name;\n switch (publicKeyType) {\n case Ed25519PublicKey.name:\n this.publicKey = publicKey;\n this.variant = EphemeralPublicKeyVariant.Ed25519;\n break;\n default:\n throw new Error(`Unsupported key for EphemeralPublicKey - ${publicKeyType}`);\n }\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Verifies a signed data with a the ephemeral public key\n *\n * @param args.message message\n * @param args.signature The signature that was signed by the private key of the ephemeral public key\n * @returns true if the signature is valid\n */\n verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {\n const { message, signature } = args;\n return this.publicKey.verifySignature({ message, signature });\n }\n\n serialize(serializer: Serializer): void {\n if (this.publicKey instanceof Ed25519PublicKey) {\n serializer.serializeU32AsUleb128(EphemeralPublicKeyVariant.Ed25519);\n this.publicKey.serialize(serializer);\n } else {\n throw new Error(\"Unknown public key type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): EphemeralPublicKey {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralPublicKeyVariant.Ed25519:\n return new EphemeralPublicKey(Ed25519PublicKey.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${index}`);\n }\n }\n\n static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {\n return publicKey instanceof EphemeralPublicKey;\n }\n}\n\n/**\n * Represents ephemeral signatures used in Aptos Keyless accounts.\n *\n * These signatures are used inside of KeylessSignature\n */\nexport class EphemeralSignature extends Signature {\n /**\n * The signature signed by the private key of an EphemeralKeyPair\n */\n public readonly signature: Signature;\n\n constructor(signature: Signature) {\n super();\n const signatureType = signature.constructor.name;\n switch (signatureType) {\n case Ed25519Signature.name:\n this.signature = signature;\n break;\n default:\n throw new Error(`Unsupported signature for EphemeralSignature - ${signatureType}`);\n }\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n static fromHex(hexInput: HexInput): EphemeralSignature {\n const data = Hex.fromHexInput(hexInput);\n const deserializer = new Deserializer(data.toUint8Array());\n return EphemeralSignature.deserialize(deserializer);\n }\n\n serialize(serializer: Serializer): void {\n if (this.signature instanceof Ed25519Signature) {\n serializer.serializeU32AsUleb128(EphemeralSignatureVariant.Ed25519);\n this.signature.serialize(serializer);\n } else {\n throw new Error(\"Unknown signature type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): EphemeralSignature {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralSignatureVariant.Ed25519:\n return new EphemeralSignature(Ed25519Signature.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for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,EAChCP,EAAe,IAAIU,EAAaF,EAAK,aAAa,CAAC,EACzD,OAAOL,EAAmB,YAAYH,CAAY,CACpD,CAEA,UAAUD,EAA8B,CACtC,GAAI,KAAK,qBAAqBO,EAC5BP,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,wBAAwB,CAE5C,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIE,EAAmBG,EAAiB,YAAYN,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CACF","names":["EphemeralPublicKey","_EphemeralPublicKey","PublicKey","publicKey","publicKeyType","Ed25519PublicKey","args","message","signature","serializer","deserializer","index","EphemeralSignature","_EphemeralSignature","Signature","signatureType","Ed25519Signature","hexInput","data","Hex","Deserializer"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromString(input);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromStringStrict(input);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"6EAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAUhC,IAAKC,OACVA,EAAA,0BAA4B,4BAC5BA,EAAA,kBAAoB,oBACpBA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,wBAA0B,0BAC1BA,EAAA,kCAAoC,oCACpCA,EAAA,uBAAyB,yBAPfA,OAAA,IA4BCC,EAAN,MAAMA,UAAuBC,CAA4C,CA+B9E,YAAYC,EAAmB,CAE7B,GADA,MAAM,EACFA,EAAM,SAAWF,EAAe,OAClC,MAAM,IAAIG,EACR,sDACA,2BACF,EAEF,KAAK,KAAOD,CACd,CAYA,WAAqB,CACnB,OACE,KAAK,KAAK,MAAM,EAAG,KAAK,KAAK,OAAS,CAAC,EAAE,MAAOE,GAASA,IAAS,CAAC,GAAK,KAAK,KAAK,KAAK,KAAK,OAAS,CAAC,EAAI,EAE9G,CAgBA,UAA0B,CACxB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAWA,uBAAgC,CAC9B,IAAIC,EAAMC,EAAW,KAAK,IAAI,EAC9B,OAAI,KAAK,UAAU,IACjBD,EAAMA,EAAIA,EAAI,OAAS,CAAC,GAEnBA,CACT,CAaA,cAA8B,CAC5B,MAAO,KAAK,KAAK,0BAA0B,CAAC,EAC9C,CAaA,2BAAoC,CAClC,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAQA,cAA2B,CACzB,OAAO,KAAK,IACd,CAaA,UAAUC,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,IAAI,CAC1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A,EAA4C,CAC5D,OAAIA,aAAiBF,EACZE,EAELA,aAAiB,WACZ,IAAIF,EAAeE,CAAK,EAE1BF,EAAe,iBAAiBE,CAAK,CAC9C,CAeA,OAAO,QAAQc,EAA6F,CAC1G,GAAI,CACF,OAAIA,EAAK,OACPhB,EAAe,WAAWgB,EAAK,KAAK,EAEpChB,EAAe,KAAKgB,EAAK,KAAK,EAEzB,CAAE,MAAO,EAAK,CACvB,OAASD,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CASA,OAAOE,EAAgC,CACrC,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAjXanB,EASK,OAAiB,GATtBA,EAcK,mBAA6B,GAdlCA,EAgBJ,KAAuBA,EAAe,KAAK,KAAK,EAhB5CA,EAkBJ,IAAsBA,EAAe,KAAK,KAAK,EAlB3CA,EAoBJ,IAAsBA,EAAe,KAAK,KAAK,EApB3CA,EAsBJ,MAAwBA,EAAe,KAAK,KAAK,EAtB7CA,EAwBJ,KAAuBA,EAAe,KAAK,KAAK,EAxBlD,IAAMoB,EAANpB","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
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-XVWNPR4T.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-CUSKA6RZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/types.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosRequest } from \"../types\";\n\n/**\n * The API response type\n *\n * @param status - the response status. i.e. 200\n * @param statusText - the response message\n * @param data the response data\n * @param url the url the request was made to\n * @param headers the response headers\n * @param config (optional) - the request object\n * @param request (optional) - the request object\n */\nexport interface AptosResponse<Req, Res> {\n status: number;\n statusText: string;\n data: Res;\n url: string;\n headers: any;\n config?: any;\n request?: Req;\n}\n\n/**\n * The type returned from an API error\n *\n * @param name - the error name \"AptosApiError\"\n * @param url the url the request was made to\n * @param status - the response status. i.e. 400\n * @param statusText - the response message\n * @param data the response data\n * @param request - the AptosRequest\n */\nexport class AptosApiError extends Error {\n readonly url: string;\n\n readonly status: number;\n\n readonly statusText: string;\n\n readonly data: any;\n\n readonly request: AptosRequest;\n\n constructor(request: AptosRequest, response: AptosResponse<any, any>, message: string) {\n super(message);\n\n this.name = \"AptosApiError\";\n this.url = response.url;\n this.status = response.status;\n this.statusText = response.statusText;\n this.data = response.data;\n this.request = request;\n }\n}\n"],"mappings":"AAoCO,IAAMA,EAAN,cAA4B,KAAM,CAWvC,YAAYC,EAAuBC,EAAmCC,EAAiB,CACrF,MAAMA,CAAO,EAEb,KAAK,KAAO,gBACZ,KAAK,IAAMD,EAAS,IACpB,KAAK,OAASA,EAAS,OACvB,KAAK,WAAaA,EAAS,WAC3B,KAAK,KAAOA,EAAS,KACrB,KAAK,QAAUD,CACjB,CACF","names":["AptosApiError","request","response","message"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as P}from"./chunk-I2T6BJOA.mjs";import{c as d}from"./chunk-L6RINMT6.mjs";import{d as h,e as w,f as k,g as T,i as b,j as q,k as v,u as O}from"./chunk-YMFEA2TJ.mjs";import{a as f}from"./chunk-7CMCN6LB.mjs";import{a as _}from"./chunk-SQQ2424E.mjs";import{b as y}from"./chunk-XWVMFCW3.mjs";import{b as l}from"./chunk-F6REP536.mjs";import{a as g}from"./chunk-77NXCSLY.mjs";import{b as c}from"./chunk-BF46IXHH.mjs";import{a as C}from"./chunk-AH44UPM4.mjs";import{b as A,d as p}from"./chunk-LBKYNX5K.mjs";import{a as m}from"./chunk-GHYE26Q5.mjs";async function S(t){let{aptosConfig:n,accountAddress:e}=t,{data:o}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${c.from(e).toString()}`});return o}async function H(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${c.from(e).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function J(t){return t.options?.ledgerVersion!==void 0?G(t):C(async()=>G(t),`module-${t.accountAddress}-${t.moduleName}`,1e3*60*5)()}async function G(t){let{aptosConfig:n,accountAddress:e,moduleName:o,options:s}=t,{data:r}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${c.from(e).toString()}/module/${o}`,params:{ledger_version:s?.ledgerVersion}});return r}async function U(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${c.from(e).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function X(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${c.from(e).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function K(t){let{aptosConfig:n,accountAddress:e,resourceType:o,options:s}=t,{data:r}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${c.from(e).toString()}/resource/${o}`,params:{ledger_version:s?.ledgerVersion}});return r.data}async function Q(t){let{aptosConfig:n,authenticationKey:e,options:o}=t,s=await K({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:r}}=s,a=c.from(e);try{let i=await P({aptosConfig:n,handle:r,data:{key:a.toString(),key_type:"address",value_type:"address"},options:o});return c.from(i)}catch(i){if(i instanceof m&&i.data.error_code==="table_item_not_found")return a;throw i}}async function Y(t){let{aptosConfig:n,accountAddress:e}=t,s={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}},a=await d({aptosConfig:n,query:{query:q,variables:{where_condition:s}},originMethod:"getAccountTokensCount"});return a.current_token_ownerships_v2_aggregate.aggregate?a.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Z(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.token_standard={_eq:o?.tokenStandard});let a={query:T,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function oo(t){let{aptosConfig:n,accountAddress:e,collectionAddress:o,options:s}=t,r=c.from(e).toStringLong(),a=c.from(o).toStringLong(),i={owner_address:{_eq:r},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};s?.tokenStandard&&(i.token_standard={_eq:s?.tokenStandard});let u={query:b,variables:{where_condition:i,offset:s?.offset,limit:s?.limit,order_by:s?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function to(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()}};o?.tokenStandard&&(r.current_collection={token_standard:{_eq:o?.tokenStandard}});let a={query:k,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function eo(t){let{aptosConfig:n,accountAddress:e}=t,o=c.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return r.account_transactions_aggregate.aggregate?r.account_transactions_aggregate.aggregate.count:0}async function no(t){let{aptosConfig:n,accountAddress:e,coinType:o}=t,s=c.from(e).toStringLong(),r=await I({aptosConfig:n,accountAddress:s,options:{where:{asset_type:{_eq:o}}}});return r[0]?r[0].amount:0}async function I(t){let{aptosConfig:n,accountAddress:e,options:o}=t,s=c.from(e).toStringLong(),r={...o?.where,owner_address:{_eq:s}},a={query:w,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ro(t){let{aptosConfig:n,accountAddress:e}=t,o=c.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:h,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!r.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return r.current_fungible_asset_balances_aggregate.aggregate.count}async function so(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()}},a={query:O,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function co(t){let{aptosConfig:n,privateKey:e}=t,o=new _(e.publicKey());if(e instanceof y){let r=g.fromPublicKey({publicKey:o}).derivedAddress();return f.fromPrivateKey({privateKey:e,address:r})}if(e instanceof l){let s=g.fromPublicKey({publicKey:o});if(await M({authKey:s,aptosConfig:n})){let u=s.derivedAddress();return f.fromPrivateKey({privateKey:e,address:u,legacy:!1})}let a=g.fromPublicKey({publicKey:o.publicKey});if(await M({authKey:a,aptosConfig:n})){let u=a.derivedAddress();return f.fromPrivateKey({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function M(t){let{aptosConfig:n,authKey:e}=t,o=await Q({aptosConfig:n,authenticationKey:e.derivedAddress()});try{return await S({aptosConfig:n,accountAddress:o}),!0}catch(s){if(s.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{S as a,H as b,J as c,U as d,X as e,K as f,Q as g,Y as h,Z as i,oo as j,to as k,eo as l,no as m,I as n,ro as o,so as p,co as q,M as r};
|
|
2
|
-
//# sourceMappingURL=chunk-PY23BQ2H.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/account.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/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../account\";\nimport { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\n\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given account address and module name\n *\n * @param args.accountAddress Hex-encoded 32 byte Aptos account address\n * @param args.moduleName The name of the module\n * @param args.query.ledgerVersion Specifies ledger version of transactions. By default, latest version will be used\n * @returns The move module.\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType: MoveStructId;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where: { asset_type: { _eq: coinType } },\n },\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * NOTE: There is a potential issue once unified single signer scheme will be adopted\n * by the community.\n *\n * Becuase on could create 2 accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we lookup the accounts. First unified\n * scheme and then legacy scheme vs first legacy scheme and then unified scheme.\n *\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"oiBA0DA,eAAsBA,EAAQC,EAGL,CACvB,GAAM,CAAE,YAAAC,EAAa,eAAAC,CAAe,EAAIF,EAClC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAkC,CACvD,YAAAH,EACA,aAAc,UACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,EAClE,CAAC,EACD,OAAOC,CACT,CAEA,eAAsBG,EAAWN,EAIC,CAChC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,QAAAK,CAAQ,EAAIP,EACjD,OAAOQ,EAA6C,CAClD,YAAAP,EACA,aAAc,aACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,WAChE,OAAQ,CACN,eAAgBK,GAAS,cACzB,MAAOA,GAAS,OAChB,MAAOA,GAAS,OAAS,GAC3B,CACF,CAAC,CACH,CAUA,eAA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AAE,WAAAL,EAAY,QAAAX,CAAQ,CAAC,CACvD,CAEA,GAAIW,aAAsBM,EAAmB,CAE3C,IAAMC,EAA8CH,EAAkB,cAAc,CAClF,UAAAH,CACF,CAAC,EAKD,GAJ+C,MAAMO,EAAe,CAClE,QAASD,EACT,YAAA1D,CACF,CAAC,EAC2C,CAC1C,IAAMwC,EAAUkB,EAA4C,eAAe,EAC3E,OAAOF,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAX,EAAS,OAAQ,EAAM,CAAC,CACtE,CAEA,IAAMoB,EAAgBL,EAAkB,cAAc,CACpD,UAAWH,EAAU,SACvB,CAAC,EAED,GADwB,MAAMO,EAAe,CAAE,QAASC,EAAe,YAAA5D,CAAY,CAAC,EAC/D,CACnB,IAAMwC,EAAUoB,EAAc,eAAe,EAC7C,OAAOJ,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAX,EAAS,OAAQ,EAAK,CAAC,CACrE,CACF,CAGA,MAAM,IAAI,MAAM,yCAAyCW,CAAU,EAAE,CACvE,CAEA,eAAsBQ,EAAe5D,EAAkF,CACrH,GAAM,CAAE,YAAAC,EAAa,QAAA6D,CAAQ,EAAI9D,EAC3BE,EAAiB,MAAMe,EAA6B,CACxD,YAAAhB,EACA,kBAAmB6D,EAAQ,eAAe,CAC5C,CAAC,EAED,GAAI,CACF,aAAM/D,EAAQ,CACZ,YAAAE,EACA,eAAAC,CACF,CAAC,EACM,EACT,OAAS6D,EAAY,CAEnB,GAAIA,EAAM,SAAW,IACnB,MAAO,GAET,MAAM,IAAI,MAAM,2CAA2C7D,EAAe,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinAmount","coinType","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetObjectData","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var g=(e=>(e.JSON="application/json",e.BCS="application/x-bcs",e.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",e.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",e))(g||{}),y=(t=>(t[t.Bool=0]="Bool",t[t.U8=1]="U8",t[t.U64=2]="U64",t[t.U128=3]="U128",t[t.Address=4]="Address",t[t.Signer=5]="Signer",t[t.Vector=6]="Vector",t[t.Struct=7]="Struct",t[t.U16=8]="U16",t[t.U32=9]="U32",t[t.U256=10]="U256",t[t.Reference=254]="Reference",t[t.Generic=255]="Generic",t))(y||{}),d=(o=>(o[o.U8=0]="U8",o[o.U64=1]="U64",o[o.U128=2]="U128",o[o.Address=3]="Address",o[o.U8Vector=4]="U8Vector",o[o.Bool=5]="Bool",o[o.U16=6]="U16",o[o.U32=7]="U32",o[o.U256=8]="U256",o))(d||{}),u=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(u||{}),c=(i=>(i[i.MultiAgentTransaction=0]="MultiAgentTransaction",i[i.FeePayerTransaction=1]="FeePayerTransaction",i))(c||{}),l=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(l||{}),_=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(_||{}),x=(n=>(n[n.Ed25519=0]="Ed25519",n[n.Secp256k1=1]="Secp256k1",n[n.Keyless=3]="Keyless",n))(x||{}),v=(n=>(n[n.Ed25519=0]="Ed25519",n[n.Secp256k1=1]="Secp256k1",n[n.Keyless=3]="Keyless",n))(v||{}),h=(p=>(p[p.Ed25519=0]="Ed25519",p))(h||{}),M=(p=>(p[p.Ed25519=0]="Ed25519",p))(M||{}),m=(p=>(p[p.ZkProof=0]="ZkProof",p))(m||{}),R=(p=>(p[p.Groth16=0]="Groth16",p))(R||{}),b=(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a))(b||{});function E(r){return r.type==="pending_transaction"}function W(r){return r.type==="user_transaction"}function F(r){return r.type==="genesis_transaction"}function I(r){return r.type==="block_metadata_transaction"}function A(r){return r.type==="state_checkpoint_transaction"}function P(r){return r.type==="validator_transaction"}function G(r){return"signature"in r&&r.signature==="ed25519_signature"}function O(r){return"signature"in r&&r.signature==="secp256k1_ecdsa_signature"}function B(r){return r.type==="multi_agent_signature"}function D(r){return r.type==="fee_payer_signature"}function N(r){return r.type==="multi_ed25519_signature"}var S=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(S||{}),C=(e=>(e.STORE="store",e.DROP="drop",e.KEY="key",e.COPY="copy",e))(C||{}),k=(i=>(i.VALIDATOR="validator",i.FULL_NODE="full_node",i))(k||{}),f=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(f||{}),T=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",i))(T||{}),U=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(U||{});export{g as a,y as b,d as c,u as d,c as e,l as f,_ as g,x as h,v as i,h as j,M as k,m as l,R as m,b as n,E as o,W as p,F as q,I as r,A as s,P as t,G as u,O as v,B as w,D as x,N as y,S as z,C as A,k as B,f as C,T as D,U as E};
|
|
2
|
-
//# sourceMappingURL=chunk-Q6LFIZ3L.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"../utils/apiEndpoints\";\nimport { OrderBy, TokenStandard } from \"./indexer\";\n\nexport * from \"./indexer\";\n\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n BCS_VIEW_FUNCTION = \"application/x.aptos.view_function+bcs\",\n}\n\n/**\n * Hex data as input to a function\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * TypeTag enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Script transaction arguments enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n}\n\n/**\n * Transaction payload enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n}\n\n/**\n * Transaction variants enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n}\n\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\nexport enum EphemeralPublicKeyVariant {\n Ed25519 = 0,\n}\n\nexport enum EphemeralSignatureVariant {\n Ed25519 = 0,\n}\n\nexport enum EphemeralCertificateVariant {\n ZkProof = 0,\n}\n\nexport enum ZkpVariant {\n Groth16 = 0,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\nexport type Uint16 = number;\nexport type Uint32 = number;\nexport type Uint64 = bigint;\nexport type Uint128 = bigint;\nexport type Uint256 = bigint;\nexport type AnyNumber = number | bigint;\n\n/**\n * Set of configuration options that can be provided when initializing the SDK.\n * The purpose of these options is to configure various aspects of the SDK's\n * behavior and interaction with the Aptos network\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly pepper?: string;\n\n readonly prover?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n\n readonly fullnodeConfig?: FullNodeConfig;\n\n readonly indexerConfig?: IndexerConfig;\n\n readonly faucetConfig?: FaucetConfig;\n};\n\n/**\n *\n * Controls the number of results that are returned and the starting position of those results.\n * @param offset parameter specifies the starting position of the query result within the set of data. Default is 0.\n * @param limit specifies the maximum number of items or records to return in a query result. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\nexport interface TokenStandardArg {\n tokenStandard?: TokenStandard;\n}\n\nexport interface OrderByArg<T extends {}> {\n orderBy?: OrderBy<T>;\n}\n\nexport interface WhereArg<T extends {}> {\n where?: T;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object we can pass with the request to the server.\n *\n * @param API_KEY - api key generated from developer portal {@link https://developers.aptoslabs.com/manage/api-keys}}\n * @param HEADERS - extra headers we want to send with the request\n * @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent\n */\nexport type ClientConfig = ClientHeadersType & {\n WITH_CREDENTIALS?: boolean;\n API_KEY?: string;\n};\n\n/**\n * A Fullnode only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n */\nexport type FullNodeConfig = ClientHeadersType;\n\n/**\n * An Indexer only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n */\nexport type IndexerConfig = ClientHeadersType;\n\n/**\n * A Faucet only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n * @param AUTH_TOKEN - an auth token to send with a faucet request\n */\nexport type FaucetConfig = ClientHeadersType & {\n AUTH_TOKEN?: string;\n};\n\n/**\n * General type definition for client HEADERS\n */\nexport type ClientHeadersType = {\n HEADERS?: Record<string, string | number | boolean>;\n};\n\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n originMethod?: string;\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e https://fullnode.devnet.aptoslabs.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n};\n\n/**\n * Specifies ledger version of transactions. By default latest version will be used\n */\nexport type LedgerVersionArg = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * Type holding the outputs of the estimate gas API\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource<T = {}> = {\n type: MoveStructId;\n data: T;\n};\n\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n Validator = \"validator_transaction\",\n}\n\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse;\n\nexport function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {\n return response.type === TransactionResponseType.Pending;\n}\n\nexport function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse {\n return response.type === TransactionResponseType.User;\n}\n\nexport function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse {\n return response.type === TransactionResponseType.Genesis;\n}\n\nexport function isBlockMetadataTransactionResponse(\n response: TransactionResponse,\n): response is BlockMetadataTransactionResponse {\n return response.type === TransactionResponseType.BlockMetadata;\n}\n\nexport function isStateCheckpointTransactionResponse(\n response: TransactionResponse,\n): response is StateCheckpointTransactionResponse {\n return response.type === TransactionResponseType.StateCheckpoint;\n}\n\nexport function isValidatorTransactionResponse(\n response: TransactionResponse,\n): response is ValidatorTransactionResponse {\n return response.type === TransactionResponseType.Validator;\n}\n\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\nexport type ValidatorTransactionResponse = {\n type: TransactionResponseType.Validator;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n /**\n * The events emitted by the validator transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Deleted table data\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveFunctionId;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * Move script bytecode\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * These are the JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature;\n\nexport function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"ed25519_signature\";\n}\n\nexport function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"secp256k1_ecdsa_signature\";\n}\n\nexport function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature {\n return signature.type === \"multi_agent_signature\";\n}\n\nexport function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return signature.type === \"fee_payer_signature\";\n}\n\nexport function isMultiEd25519Signature(\n signature: TransactionSignature,\n): signature is TransactionMultiEd25519Signature {\n return signature.type === \"multi_ed25519_signature\";\n}\n\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures.\n */\nexport type AccountSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * Map of Move types to local TypeScript types\n */\nexport type MoveUint8Type = number;\nexport type MoveUint16Type = number;\nexport type MoveUint32Type = number;\nexport type MoveUint64Type = string;\nexport type MoveUint128Type = string;\nexport type MoveUint256Type = string;\nexport type MoveAddressType = string;\nexport type MoveObjectType = string;\nexport type MoveOptionType = MoveType | null | undefined;\n/**\n * This is the format for a fully qualified struct, resource, or entry function in Move.\n */\nexport type MoveStructId = `${string}::${string}::${string}`;\n// These are the same, unfortunately, it reads really strangely to take a StructId for a Function and there wasn't a\n// good middle ground name.\nexport type MoveFunctionId = MoveStructId;\n\n// TODO: Add support for looking up ABI to add proper typing\nexport type MoveStructType = {};\n\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructId\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * Move module id is a string representation of Move module.\n * Module name is case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Move function visibility\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Move function ability\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities tied to the generic type param and associated with the function that uses it\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * Move struct field\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n// REQUEST TYPES\n\n/**\n * Table Item request for the GetTableItem API\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of Authentication Key schemes that are supported by Aptos.\n *\n * They are combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Scheme used for deriving account addresses from other data\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Option properties to pass for waitForTransaction() function\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n waitForIndexer?: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Ed25519 or Legacy Ed25519\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Secp256k1\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"AAQO,IAAKA,OAIVA,EAAA,KAAO,mBAIPA,EAAA,IAAM,oBAINA,EAAA,uBAAyB,6CACzBA,EAAA,kBAAoB,wCAbVA,OAAA,IAyBAC,OACVA,IAAA,KAAO,GAAP,OACAA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,IAAP,OACAA,IAAA,UAAY,KAAZ,YACAA,IAAA,QAAU,KAAV,UAbUA,OAAA,IAoBAC,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,SAAW,GAAX,WACAA,IAAA,KAAO,GAAP,OACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OATUA,OAAA,IAgBAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,SAAW,GAAX,WAHUA,OAAA,IAUAC,OACVA,IAAA,sBAAwB,GAAxB,wBACAA,IAAA,oBAAsB,GAAtB,sBAFUA,OAAA,IASAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,aAAe,GAAf,eACAA,IAAA,WAAa,GAAb,aACAA,IAAA,SAAW,GAAX,WACAA,IAAA,aAAe,GAAf,eALUA,OAAA,IAYAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,aAAe,GAAf,eACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,SAA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LO,IAAKK,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SAHCA,OAAA,IASAC,OACVA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,IAAM,MACNA,EAAA,KAAO,OAJGA,OAAA,IA6FAC,OACVA,EAAA,UAAY,YACZA,EAAA,UAAY,YAFFA,OAAA,IA4DAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,aAAe,GAAf,eAIAA,IAAA,UAAY,GAAZ,YAEAA,IAAA,SAAW,GAAX,WAdUA,OAAA,IAiBAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,eAAiB,GAAjB,iBARUA,OAAA,IAcAC,OAIVA,IAAA,WAAa,KAAb,aAIAA,IAAA,8BAAgC,KAAhC,gCAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,6BAA+B,KAA/B,+BApBUA,OAAA","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","AnyPublicKeyVariant","AnySignatureVariant","EphemeralPublicKeyVariant","EphemeralSignatureVariant","EphemeralCertificateVariant","ZkpVariant","TransactionResponseType","isPendingTransactionResponse","response","isUserTransactionResponse","isGenesisTransactionResponse","isBlockMetadataTransactionResponse","isStateCheckpointTransactionResponse","isValidatorTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as a}from"./chunk-L6RINMT6.mjs";import{p as d}from"./chunk-YMFEA2TJ.mjs";import{b as p}from"./chunk-BF46IXHH.mjs";var g=300,y=o=>{if(o&&o.length>g)throw new Error(`Event type length exceeds the maximum length of ${g}`)};async function f(o){let{aptosConfig:n,eventType:e,options:t}=o,r={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:t,orderBy:t?.orderBy};return c({aptosConfig:n,options:r})}async function h(o){let{accountAddress:n,aptosConfig:e,creationNumber:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},creation_number:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function _(o){let{accountAddress:n,aptosConfig:e,eventType:t,options:s}=o,i={where:{account_address:{_eq:p.from(n).toStringLong()},indexed_type:{_eq:t}},pagination:s,orderBy:s?.orderBy};return c({aptosConfig:e,options:i})}async function c(o){let{aptosConfig:n,options:e}=o;y(e?.where?.indexed_type?._eq);let t={query:d,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await a({aptosConfig:n,query:t,originMethod:"getEvents"})).events}export{f as a,h as b,_ as c,c as d};
|
|
2
|
-
//# sourceMappingURL=chunk-Q7ZP25NJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/event.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/event}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * event namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderByArg, WhereArg } from \"../types\";\nimport { GetEventsQuery } from \"../types/generated/operations\";\nimport { GetEvents } from \"../types/generated/queries\";\nimport { EventsBoolExp, InputMaybe } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\nconst MAX_EVENT_TYPE_LENGTH = 300;\nconst checkEventTypeLength = (eventType?: InputMaybe<string>) => {\n if (eventType && eventType.length > MAX_EVENT_TYPE_LENGTH) {\n throw new Error(`Event type length exceeds the maximum length of ${MAX_EVENT_TYPE_LENGTH}`);\n }\n};\n\nexport async function getModuleEventsByEventType(args: {\n aptosConfig: AptosConfig;\n eventType: MoveStructId;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n}): Promise<GetEventsResponse> {\n const { aptosConfig, eventType, options } = args;\n\n const whereCondition: EventsBoolExp = {\n account_address: { _eq: \"0x0000000000000000000000000000000000000000000000000000000000000000\" },\n creation_number: { _eq: \"0\" },\n sequence_number: { _eq: \"0\" },\n indexed_type: { _eq: eventType },\n };\n\n const customOptions = {\n where: whereCondition,\n pagination: options,\n orderBy: options?.orderBy,\n };\n\n return getEvents({ aptosConfig, options: customOptions });\n}\n\nexport async function getAccountEventsByCreationNumber(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n creationNumber: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n}): Promise<GetEventsResponse> {\n const { accountAddress, aptosConfig, creationNumber, options } = args;\n const address = AccountAddress.from(accountAddress);\n\n const whereCondition: EventsBoolExp = {\n account_address: { _eq: address.toStringLong() },\n creation_number: { _eq: creationNumber },\n };\n\n const customOptions = {\n where: whereCondition,\n pagination: options,\n orderBy: options?.orderBy,\n };\n\n return getEvents({ aptosConfig, options: customOptions });\n}\n\nexport async function getAccountEventsByEventType(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n eventType: MoveStructId;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n}): Promise<GetEventsResponse> {\n const { accountAddress, aptosConfig, eventType, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: EventsBoolExp = {\n account_address: { _eq: address },\n indexed_type: { _eq: eventType },\n };\n\n const customOptions = {\n where: whereCondition,\n pagination: options,\n orderBy: options?.orderBy,\n };\n\n return getEvents({ aptosConfig, options: customOptions });\n}\n\nexport async function getEvents(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;\n}): Promise<GetEventsResponse> {\n const { aptosConfig, options } = args;\n // eslint-disable-next-line no-underscore-dangle\n checkEventTypeLength(options?.where?.indexed_type?._eq);\n\n const graphqlQuery = {\n query: GetEvents,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetEventsQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getEvents\",\n });\n\n return data.events;\n}\n"],"mappings":"2HAkBA,IAAMA,EAAwB,IACxBC,EAAwBC,GAAmC,CAC/D,GAAIA,GAAaA,EAAU,OAASF,EAClC,MAAM,IAAI,MAAM,mDAAmDA,CAAqB,EAAE,CAE9F,EAEA,eAAsBG,EAA2BC,EAIlB,CAC7B,GAAM,CAAE,YAAAC,EAAa,UAAAH,EAAW,QAAAI,CAAQ,EAAIF,EAStCG,EAAgB,CACpB,MARoC,CACpC,gBAAiB,CAAE,IAAK,oEAAqE,EAC7F,gBAAiB,CAAE,IAAK,GAAI,EAC5B,gBAAiB,CAAE,IAAK,GAAI,EAC5B,aAAc,CAAE,IAAKL,CAAU,CACjC,EAIE,WAAYI,EACZ,QAASA,GAAS,OACpB,EAEA,OAAOE,EAAU,CAAE,YAAAH,EAAa,QAASE,CAAc,CAAC,CAC1D,CAEA,eAAsBE,EAAiCL,EAKxB,CAC7B,GAAM,CAAE,eAAAM,EAAgB,YAAAL,EAAa,eAAAM,EAAgB,QAAAL,CAAQ,EAAIF,EAQ3DG,EAAgB,CACpB,MANoC,CACpC,gBAAiB,CAAE,IAHLK,EAAe,KAAKF,CAAc,EAGhB,aAAa,CAAE,EAC/C,gBAAiB,CAAE,IAAKC,CAAe,CACzC,EAIE,WAAYL,EACZ,QAASA,GAAS,OACpB,EAEA,OAAOE,EAAU,CAAE,YAAAH,EAAa,QAASE,CAAc,CAAC,CAC1D,CAEA,eAAsBM,EAA4BT,EAKnB,CAC7B,GAAM,CAAE,eAAAM,EAAgB,YAAAL,EAAa,UAAAH,EAAW,QAAAI,CAAQ,EAAIF,EAQtDG,EAAgB,CACpB,MANoC,CACpC,gBAAiB,CAAE,IAHLK,EAAe,KAAKF,CAAc,EAAE,aAAa,CAG/B,EAChC,aAAc,CAAE,IAAKR,CAAU,CACjC,EAIE,WAAYI,EACZ,QAASA,GAAS,OACpB,EAEA,OAAOE,EAAU,CAAE,YAAAH,EAAa,QAASE,CAAc,CAAC,CAC1D,CAEA,eAAsBC,EAAUJ,EAGD,CAC7B,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAEjCH,EAAqBK,GAAS,OAAO,cAAc,GAAG,EAEtD,IAAMQ,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBT,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAQA,OANa,MAAMU,EAA6B,CAC9C,YAAAX,EACA,MAAOS,EACP,aAAc,WAChB,CAAC,GAEW,MACd","names":["MAX_EVENT_TYPE_LENGTH","checkEventTypeLength","eventType","getModuleEventsByEventType","args","aptosConfig","options","customOptions","getEvents","getAccountEventsByCreationNumber","accountAddress","creationNumber","AccountAddress","getAccountEventsByEventType","graphqlQuery","GetEvents","queryIndexer"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-RFSO3JRG.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-GHYE26Q5.mjs";import{a as p}from"./chunk-4KYQ7N3N.mjs";var l={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(s,R){let{url:o,method:i,body:u,contentType:d,params:t,overrides:e,originMethod:n}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${p}`,"content-type":d??"application/json","x-aptos-typescript-sdk-origin-method":n};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),R.provider({url:o,method:i,body:u,params:t,headers:r,overrides:e})}async function N(s,R,o){let{url:i,path:u}=s,d=u?`${i}/${u}`:i,t=await c({...s,url:d},R.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:d};if(e.status===401)throw new a(s,e,`Error: ${e.data}`);if(o==="Indexer"){let r=e.data;if(r.errors)throw new a(s,e,`Indexer error: ${r.errors[0].message}`??`Indexer unhandled Error ${t.status} : ${t.statusText}`);e.data=r.data}else if((o==="Pepper"||o==="Prover")&&e.status>=400)throw new a(s,e,`${t.data}`);if(e.status>=200&&e.status<300)return e;let n;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?n=JSON.stringify(e.data):e.status in l?n=l[e.status]:n=`Unhandled Error ${e.status} : ${e.statusText}`,new a(s,e,`${o} error: ${n}`)}export{c as a,N as b};
|
|
2
|
-
//# sourceMappingURL=chunk-TZOKV22Z.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = path ? `${url}/${path}` : url;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e API_KEY error)\n if (result.status === 401) {\n throw new AptosApiError(options, result, `Error: ${result.data}`);\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = result.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n `Indexer error: ${indexerResponse.errors[0].message}` ??\n `Indexer unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (result.status >= 400) {\n throw new AptosApiError(options, result, `${response.data}`);\n }\n }\n\n if (result.status >= 200 && result.status < 300) {\n return result;\n }\n\n let errorMessage: string;\n\n if (result && result.data && \"message\" in result.data && \"error_code\" in result.data) {\n errorMessage = JSON.stringify(result.data);\n } else if (result.status in errors) {\n // If it's not an API type, it must come form infra, these are prehandled\n errorMessage = errors[result.status];\n } else {\n // Everything else is unhandled\n errorMessage = `Unhandled Error ${result.status} : ${result.statusText}`;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError(options, result, `${apiType} error: ${errorMessage}`);\n}\n"],"mappings":"6EAYA,IAAMA,EAAiC,CACrC,IAAK,cACL,IAAK,eACL,IAAK,YACL,IAAK,YACL,IAAK,oBACL,IAAK,wBACL,IAAK,cACL,IAAK,qBACP,EAMA,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,GAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,aAAAC,CAAa,EAAIR,EACtES,EAAoE,CACxE,GAAGF,GAAW,QACd,iBAAkB,wBAAwBG,CAAO,GACjD,eAAgBL,sBAChB,uCAAwCG,CAC1C,EAEA,OAAID,GAAW,aACbE,EAAQ,cAAgB,UAAUF,GAAW,UAAU,IAErDA,GAAW,UACbE,EAAQ,cAAgB,UAAUF,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAG,EACA,UAAAF,CACF,CAAC,CACH,CASA,eAAsBI,EACpBX,EACAY,EACAC,EACkC,CAClC,GAAM,CAAE,IAAAX,EAAK,KAAAY,CAAK,EAAId,EAChBe,EAAUD,EAAO,GAAGZ,CAAG,IAAIY,CAAI,GAAKZ,EACpCc,EAAW,MAAMjB,EAAkB,CAAE,GAAGC,EAAS,IAAKe,CAAQ,EAAGH,EAAY,MAAM,EAEnFK,EAAkC,CACtC,OAAQD,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMA,EAAS,KACf,QAASA,EAAS,QAClB,OAAQA,EAAS,OACjB,QAASA,EAAS,QAClB,IAAKD,CACP,EAGA,GAAIE,EAAO,SAAW,IACpB,MAAM,IAAIC,EAAclB,EAASiB,EAAQ,UAAUA,EAAO,IAAI,EAAE,EAKlE,GAAIJ,cAAkC,CACpC,IAAMM,EAAkBF,EAAO,KAE/B,GAAIE,EAAgB,OAClB,MAAM,IAAID,EACRlB,EACAiB,EACA,kBAAkBE,EAAgB,OAAO,CAAC,EAAE,OAAO,IACjD,2BAA2BH,EAAS,MAAM,MAAMA,EAAS,UAAU,EACvE,EAEFC,EAAO,KAAOE,EAAgB,IAChC,UAAWN,cAAmCA,eACxCI,EAAO,QAAU,IACnB,MAAM,IAAIC,EAAclB,EAASiB,EAAQ,GAAGD,EAAS,IAAI,EAAE,EAI/D,GAAIC,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAOA,EAGT,IAAIG,EAEJ,MAAIH,GAAUA,EAAO,MAAQ,YAAaA,EAAO,MAAQ,eAAgBA,EAAO,KAC9EG,EAAe,KAAK,UAAUH,EAAO,IAAI,EAChCA,EAAO,UAAUnB,EAE1BsB,EAAetB,EAAOmB,EAAO,MAAM,EAGnCG,EAAe,mBAAmBH,EAAO,MAAM,MAAMA,EAAO,UAAU,GAKlE,IAAIC,EAAclB,EAASiB,EAAQ,GAAGJ,CAAO,WAAWO,CAAY,EAAE,CAC9E","names":["errors","request","options","client","url","method","body","contentType","params","overrides","originMethod","headers","VERSION","aptosRequest","aptosConfig","apiType","path","fullUrl","response","result","AptosApiError","indexerResponse","errorMessage"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport EventEmitter from \"eventemitter3\";\nimport { EphemeralCertificateVariant, HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n EphemeralCertificate,\n Signature,\n ZeroKnowledgeSig,\n ZkProof,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { deriveTransactionType, generateSigningMessage } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../transactions/types\";\nimport { base64UrlDecode } from \"../utils/helpers\";\n\n/**\n * Account implementation for the Keyless authentication scheme.\n *\n * Used to represent a Keyless based account and sign transactions with it.\n *\n * Use KeylessAccount.fromJWTAndProof to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.\n *\n * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,\n * EphemeralKeyPair, and corresponding proof.\n */\nexport class KeylessAccount extends Serializable implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n /**\n * The KeylessPublicKey associated with the account\n */\n readonly publicKey: KeylessPublicKey;\n\n /**\n * The EphemeralKeyPair used to generate sign.\n */\n readonly ephemeralKeyPair: EphemeralKeyPair;\n\n /**\n * The claim on the JWT to identify a user. This is typically 'sub' or 'email'.\n */\n readonly uidKey: string;\n\n /**\n * The value of the uidKey claim on the JWT. This intended to be a stable user identifier.\n */\n readonly uidVal: string;\n\n /**\n * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's\n * OIDC registration with the identity provider.\n */\n readonly aud: string;\n\n /**\n * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.\n */\n readonly pepper: Uint8Array;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.\n */\n proof: ZeroKnowledgeSig | undefined;\n\n /**\n * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on\n * fetching the proof.\n */\n readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The JWT token used to derive the account\n */\n readonly jwt: string;\n\n /**\n * An event emitter used to assist in handling asycronous proof fetching.\n */\n private readonly emitter: EventEmitter<ProofFetchEvents>;\n\n // Use the static constructor 'create' instead.\n private constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n }) {\n super();\n const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proof, proofFetchCallback, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n this.publicKey = KeylessPublicKey.create(args);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proof;\n if (proof instanceof ZeroKnowledgeSig) {\n this.proof = proof;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback for async proof fetch\");\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n this.init(proof);\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 /**\n * This initializes the asyncronous proof fetch\n * @return\n */\n async init(promise: Promise<ZeroKnowledgeSig>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", { status: \"Success\" });\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: error.toString() });\n } else {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: \"Unknown\" });\n }\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Connot serialize - proof undefined\");\n }\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return KeylessAccount.create({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n /**\n * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair\n * and JWT token.\n * @return boolean\n */\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n /**\n * Sign a message using Keyless.\n * @param message the message to sign, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.sign(message));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Sign a transaction using Keyless.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.signTransaction(transaction));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Waits for asyncronous proof fetching to finish.\n * @return\n */\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n /**\n * Sign the given message using Keyless.\n * @param message in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): KeylessSignature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n if (this.isExpired()) {\n throw new Error(\"EphemeralKeyPair is expired\");\n }\n if (this.proof === undefined) {\n throw new Error(\"Proof not defined\");\n }\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(this.jwt.split(\".\")[0]),\n ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n /**\n * Sign the given transaction with Keyless.\n * Signs the transaction and proof to guard against proof malleability.\n * @param transaction the transaction to be signed\n * @returns KeylessSignature\n */\n signTransaction(transaction: AnyRawTransaction): KeylessSignature {\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n const raw = deriveTransactionType(transaction);\n const txnAndProof = new TransactionAndProof(raw, this.proof.proof);\n const signMess = txnAndProof.hash();\n return this.sign(signMess);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n throw new Error(\"Not implemented\");\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(bytes));\n }\n\n static create(args: {\n address?: AccountAddress;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): KeylessAccount {\n const { address, proof, jwt, ephemeralKeyPair, pepper, uidKey = \"sub\", proofFetchCallback } = args;\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 address,\n proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n}\n\n/**\n * A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create\n * the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.\n */\nclass TransactionAndProof extends Serializable {\n /**\n * The transaction to sign.\n */\n transaction: AnyRawTransactionInstance;\n\n /**\n * The zero knowledge proof used in signing the transaction.\n */\n proof?: ZkProof;\n\n /**\n * The domain separator prefix used when hashing.\n */\n readonly domainSeparator = \"APTOS::TransactionAndProof\";\n\n constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {\n super();\n this.transaction = transaction;\n this.proof = proof;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.transaction.bcsToBytes());\n serializer.serializeOption(this.proof);\n }\n\n /**\n * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.\n *\n * @returns Uint8Array\n */\n hash(): Uint8Array {\n return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);\n }\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n"],"mappings":"6bAGA,OAAqB,aAAAA,MAAiB,aACtC,OAAOC,MAAkB,gBAiClB,IAAMC,EAAN,MAAMA,UAAuBC,CAAgC,CAkE1D,YAAYC,EAWjB,CACD,MAAM,EACN,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,OAAAC,EAAQ,OAAAC,EAAQ,IAAAC,EAAK,OAAAC,EAAQ,MAAAC,EAAO,mBAAAC,EAAoB,IAAAC,CAAI,EAAIT,EAUnG,GATA,KAAK,iBAAmBE,EACxB,KAAK,UAAYQ,EAAiB,OAAOV,CAAI,EAC7C,KAAK,eAAiBC,EAAUU,EAAe,KAAKV,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,EACvG,KAAK,OAASE,EACd,KAAK,OAASC,EACd,KAAK,IAAMC,EACX,KAAK,IAAMI,EACX,KAAK,QAAU,IAAIG,EACnB,KAAK,eAAiBL,EAClBA,aAAiBM,EACnB,KAAK,MAAQN,MACR,CACL,GAAIC,IAAuB,OACzB,MAAM,IAAI,MAAM,6CAA6C,EAE/D,KAAK,QAAQ,GAAG,mBAAoB,MAAOM,GAAW,CACpD,MAAMN,EAAmBM,CAAM,EAC/B,KAAK,QAAQ,mBAAmB,CAClC,CAAC,EACD,KAAK,KAAKP,CAAK,CACjB,CACA,KAAK,cAAgB,EACrB,IAAMQ,EAAcC,EAAI,aAAaV,CAAM,EAAE,aAAa,EAC1D,GAAIS,EAAY,SAAWjB,EAAe,cACxC,MAAM,IAAI,MAAM,oCAAoCA,EAAe,aAAa,EAAE,EAEpF,KAAK,OAASiB,CAChB,CAMA,MAAM,KAAKE,EAAoC,CAC7C,GAAI,CACF,KAAK,MAAQ,MAAMA,EACnB,KAAK,QAAQ,KAAK,mBAAoB,CAAE,OAAQ,SAAU,CAAC,CAC7D,OAASC,EAAO,CACVA,aAAi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AC,EACA,IAAAG,EACA,mBAAAD,CACF,CAAC,CACH,CACF,EAlRaV,EACK,cAAwB,GADnC,IAAM+C,EAAN/C,EAwRDyC,EAAN,cAAkCxC,CAAa,CAgB7C,YAAY6B,EAAwCrB,EAAiB,CACnE,MAAM,EAHR,KAAS,gBAAkB,6BAIzB,KAAK,YAAcqB,EACnB,KAAK,MAAQrB,CACf,CAEA,UAAUY,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,YAAY,WAAW,CAAC,EAC5DA,EAAW,gBAAgB,KAAK,KAAK,CACvC,CAOA,MAAmB,CACjB,OAAO2B,EAAuB,KAAK,WAAW,EAAG,KAAK,eAAe,CACvE,CACF","names":["jwtDecode","EventEmitter","_KeylessAccount","Serializable","args","address","ephemeralKeyPair","uidKey","uidVal","aud","pepper","proof","proofFetchCallback","jwt","KeylessPublicKey","AccountAddress","EventEmitter","ZeroKnowledgeSig","status","pepperBytes","Hex","promise","error","serializer","deserializer","EphemeralKeyPair","message","signature","AnySignature","publicKey","AnyPublicKey","AccountAuthenticatorSingleKey","transaction","data","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","KeylessSignature","base64UrlDecode","EphemeralCertificate","raw","deriveTransactionType","signMess","TransactionAndProof","bytes","Deserializer","jwtPayload","jwtDecode","iss","KeylessAccount","generateSigningMessage"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk-4GNJJZ4R.mjs";import{a as m}from"./chunk-IPTCWBFV.mjs";import{c as A}from"./chunk-L6RINMT6.mjs";import{s as f}from"./chunk-YMFEA2TJ.mjs";import{b as w}from"./chunk-BF46IXHH.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(n))throw new Error(`${n} is not valid. ${T}`);if(t&&!E(t))throw new Error(`${t} is not valid. ${T}`);return{domainName:t||n,subdomainName:t?n:void 0}}var z="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null};function d(e){let n=P[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function V(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function j(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(n),{domainName:N,subdomainName:l}=c(o),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(l&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!l)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let h=t.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let D=h*31536e3;return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[N,D,s,i]},options:a})}if(!l)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await I({aptosConfig:n,name:N});if(!_)throw new Error("The domain does not exist");let x=t.policy==="subdomain:independent"?t.expirationDate:_;if(x>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[N,l,Math.round(x/1e3),t.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function I(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await g({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function Y(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await g({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function K(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function W(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function F(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function H(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await A({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function J(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function X(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function Z(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function ee(e){let{aptosConfig:n,options:t,domain:o}=e;return(await A({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await g({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function ne(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,E as b,c,z as d,G as e,V as f,j as g,I as h,Y as i,K as j,W as k,F as l,H as m,J as n,X as o,Z as p,ee as q,ne as r};
|
|
2
|
-
//# sourceMappingURL=chunk-XVWNPR4T.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/ans.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/name}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * name namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Account } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { GetNamesQuery } from \"../types/generated/operations\";\nimport { GetNames } from \"../types/generated/queries\";\nimport { CurrentAptosNamesBoolExp } from \"../types/generated/types\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { queryIndexer } from \"./general\";\nimport { view } from \"./view\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport const VALIDATION_RULES_DESCRIPTION = [\n \"A name must be between 3 and 63 characters long,\",\n \"and can only contain lowercase a-z, 0-9, and hyphens.\",\n \"A name may not start or end with a hyphen.\",\n].join(\" \");\n\n/**\n *\n * @param fragment A fragment of a name, either the domain or subdomain\n * @returns boolean indicating if the fragment is a valid fragment\n */\nexport function isValidANSSegment(fragment: string): boolean {\n if (!fragment) return false;\n if (fragment.length < 3) return false;\n if (fragment.length > 63) return false;\n // only lowercase a-z and 0-9 are allowed, along with -. a domain may not start or end with a hyphen\n if (!/^[a-z\\d][a-z\\d-]{1,61}[a-z\\d]$/.test(fragment)) return false;\n return true;\n}\n\n/**\n * Checks if an ANS name is valid or not\n *\n * @param name A string of the domain name, can include or exclude the .apt suffix\n */\nexport function isValidANSName(name: string): { domainName: string; subdomainName?: string } {\n const [first, second, ...rest] = name.replace(/\\.apt$/, \"\").split(\".\");\n\n if (rest.length > 0) {\n throw new Error(`${name} is invalid. A name can only have two parts, a domain and a subdomain separated by a \".\"`);\n }\n\n if (!isValidANSSegment(first)) {\n throw new Error(`${first} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n if (second && !isValidANSSegment(second)) {\n throw new Error(`${second} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n return {\n domainName: second || first,\n subdomainName: second ? first : undefined,\n };\n}\n\nexport const LOCAL_ANS_ACCOUNT_PK =\n process.env.ANS_TEST_ACCOUNT_PRIVATE_KEY ?? \"0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221\";\nexport const LOCAL_ANS_ACCOUNT_ADDRESS =\n process.env.ANS_TEST_ACCOUNT_ADDRESS ?? \"0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82\";\n\nconst NetworkToAnsContract: Record<Network, string | null> = {\n [Network.TESTNET]: \"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c\",\n [Network.MAINNET]: \"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c\",\n [Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,\n [Network.CUSTOM]: null,\n [Network.DEVNET]: null,\n};\n\nfunction getRouterAddress(aptosConfig: AptosConfig): string {\n const address = NetworkToAnsContract[aptosConfig.network];\n if (!address) throw new Error(`The ANS contract is not deployed to ${aptosConfig.network}`);\n return address;\n}\n\nconst unwrapOption = <T>(option: any): T | undefined => {\n if (!!option && typeof option === \"object\" && \"vec\" in option && Array.isArray(option.vec)) {\n return option.vec[0];\n }\n\n return undefined;\n};\n\nexport async function getOwnerAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_owner_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const owner = unwrapOption<MoveAddressType>(res[0]);\n\n return owner ? AccountAddress.from(owner) : undefined;\n}\n\nexport interface RegisterNameParameters {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n expiration:\n | { policy: \"domain\"; years?: 1 }\n | { policy: \"subdomain:follow-domain\" }\n | { policy: \"subdomain:independent\"; expirationDate: number };\n transferable?: boolean;\n toAddress?: AccountAddressInput;\n targetAddress?: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}\n\nexport async function registerName(args: RegisterNameParameters): Promise<SimpleTransaction> {\n const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const hasSubdomainPolicy =\n expiration.policy === \"subdomain:independent\" || expiration.policy === \"subdomain:follow-domain\";\n\n if (subdomainName && !hasSubdomainPolicy) {\n throw new Error(\n \"Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'\",\n );\n }\n\n if (hasSubdomainPolicy && !subdomainName) {\n throw new Error(`Policy is set to ${expiration.policy} but no subdomain was provided`);\n }\n\n if (expiration.policy === \"domain\") {\n const years = expiration.years ?? 1;\n if (years !== 1) {\n throw new Error(\"For now, names can only be registered for 1 year at a time\");\n }\n\n const secondsInYear = 31536000;\n const registrationDuration = years * secondsInYear;\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_domain`,\n functionArguments: [domainName, registrationDuration, targetAddress, toAddress],\n },\n options,\n });\n\n return transaction;\n }\n\n // We are a subdomain\n if (!subdomainName) {\n throw new Error(`${expiration.policy} requires a subdomain to be provided.`);\n }\n\n const tldExpiration = await getExpiration({ aptosConfig, name: domainName });\n if (!tldExpiration) {\n throw new Error(\"The domain does not exist\");\n }\n\n const expirationDateInMillisecondsSinceEpoch =\n expiration.policy === \"subdomain:independent\" ? expiration.expirationDate : tldExpiration;\n\n if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {\n throw new Error(\"The subdomain expiration time cannot be greater than the domain expiration time\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_subdomain`,\n functionArguments: [\n domainName,\n subdomainName,\n Math.round(expirationDateInMillisecondsSinceEpoch / 1000),\n expiration.policy === \"subdomain:follow-domain\" ? 1 : 0,\n !!transferable,\n targetAddress,\n toAddress,\n ],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n try {\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_expiration`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n // Normalize expiration time from epoch seconds to epoch milliseconds\n return Number(res[0]) * 1000;\n } catch (e) {\n return undefined;\n }\n}\n\nexport async function getPrimaryName(args: {\n aptosConfig: AptosConfig;\n address: AccountAddressInput;\n}): Promise<string | undefined> {\n const { aptosConfig, address } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_primary_name`,\n functionArguments: [AccountAddress.from(address).toString()],\n },\n });\n\n const domainName = unwrapOption<MoveAddressType>(res[1]);\n const subdomainName = unwrapOption<MoveAddressType>(res[0]);\n\n if (!domainName) return undefined;\n\n return [subdomainName, domainName].filter(Boolean).join(\".\");\n}\n\nexport async function setPrimaryName(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n if (!name) {\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::clear_primary_name`,\n functionArguments: [],\n },\n options,\n });\n\n return transaction;\n }\n\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_primary_name`,\n functionArguments: [domainName, subdomainName],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getTargetAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_target_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const target = unwrapOption<MoveAddressType>(res[0]);\n return target ? AccountAddress.from(target) : undefined;\n}\n\nexport async function setTargetAddress(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, address, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_target_addr`,\n functionArguments: [domainName, subdomainName, address],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getName(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<GetANSNameResponse[0] | undefined> {\n const { aptosConfig, name } = args;\n const { domainName, subdomainName = \"\" } = isValidANSName(name);\n\n const where: CurrentAptosNamesBoolExp = {\n domain: { _eq: domainName },\n subdomain: { _eq: subdomainName },\n is_active: { _eq: true },\n };\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n query: {\n query: GetNames,\n variables: {\n where_condition: where,\n limit: 1,\n },\n },\n originMethod: \"getName\",\n });\n\n // Convert the expiration_timestamp from an ISO string to milliseconds since epoch\n let res = data.current_aptos_names[0];\n if (res) {\n res = sanitizeANSName(res);\n }\n\n return res;\n}\n\ninterface QueryNamesOptions {\n options?: PaginationArgs & OrderByArg<GetANSNameResponse[0]> & WhereArg<CurrentAptosNamesBoolExp>;\n}\n\nexport interface GetAccountNamesArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountNames(\n args: { aptosConfig: AptosConfig } & GetAccountNamesArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountNames\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetAccountDomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountDomains(\n args: { aptosConfig: AptosConfig } & GetAccountDomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountDomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _eq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetAccountSubdomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountSubdomains(\n args: { aptosConfig: AptosConfig } & GetAccountSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetDomainSubdomainsArgs extends QueryNamesOptions {\n domain: string;\n}\n\nexport async function getDomainSubdomains(\n args: { aptosConfig: AptosConfig } & GetDomainSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, domain } = args;\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getDomainSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n domain: { _eq: domain },\n subdomain: { _neq: \"\" },\n is_active: { _eq: true },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * This function returns the expiration date in which a name is fully expired as\n * defined by the contract. The grace period allows for names to be past\n * expiration for a certain amount of time before they are released to the\n * public. The names will not function as normal, but the owner can renew\n * without others taking ownership of the name. At the time of writing, the\n * contract specified 30 days.\n *\n * @param args.aptosConfig an AptosConfig object\n * @returns\n */\nasync function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise<string> {\n const { aptosConfig } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const [gracePeriodInSeconds] = await view<[number]>({\n aptosConfig,\n payload: {\n function: `${routerAddress}::config::reregistration_grace_sec`,\n functionArguments: [],\n },\n });\n\n const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;\n const now = () => new Date();\n return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();\n}\n\nexport async function renewDomain(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, years = 1, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const renewalDuration = years * 31536000;\n const { domainName, subdomainName } = isValidANSName(name);\n\n if (subdomainName) {\n throw new Error(\"Subdomains cannot be renewed\");\n }\n\n if (years !== 1) {\n throw new Error(\"Currently, only 1 year renewals are supported\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::renew_domain`,\n functionArguments: [domainName, renewalDuration],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * The indexer returns ISO strings for expiration, however the contract works in\n * epoch milliseconds. This function converts the ISO string to epoch\n * milliseconds. In the future, if other properties need sanitization, this can\n * be extended.\n */\nfunction sanitizeANSName(name: GetANSNameResponse[0]): GetANSNameResponse[0] {\n return {\n ...name,\n expiration_timestamp: new Date(name.expiration_timestamp).getTime(),\n };\n}\n"],"mappings":"6MAwBO,IAAMA,EAA+B,CAC1C,mDACA,wDACA,4CACF,EAAE,KAAK,GAAG,EAOH,SAASC,EAAkBC,EAA2B,CAK3D,MAJI,GAACA,GACDA,EAAS,OAAS,GAClBA,EAAS,OAAS,IAElB,CAAC,iCAAiC,KAAKA,CAAQ,EAErD,CAOO,SAASC,EAAeC,EAA8D,CAC3F,GAAM,CAACC,EAAOC,EAAQ,GAAGC,CAAI,EAAIH,EAAK,QAAQ,SAAU,EAAE,EAAE,MAAM,GAAG,EAErE,GAAIG,EAAK,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CACP,SAAU,GAAGM,CAAa,qCAC1B,kBAAmB,CAAC,CACtB,CACF,CAAC,EAEKuC,EAAoBD,EAAuB,GAAK,GAAK,GACrDE,EAAM,IAAM,IAAI,KACtB,OAAO,IAAI,KAAKA,EAAI,EAAE,QAAQA,EAAI,EAAE,QAAQ,EAAID,CAAiB,CAAC,EAAE,YAAY,CAClF,CAEA,eAAsBE,GAAY1C,EAMH,CAC7B,GAAM,CAAE,YAAAL,EAAa,OAAAe,EAAQ,KAAAvB,EAAM,MAAA6B,EAAQ,EAAG,QAAAH,CAAQ,EAAIb,EACpDC,EAAgBP,EAAiBC,CAAW,EAC5CgD,EAAkB3B,EAAQ,QAC1B,CAAE,WAAAd,EAAY,cAAAC,CAAc,EAAIjB,EAAeC,CAAI,EAEzD,GAAIgB,EACF,MAAM,IAAI,MAAM,8BAA8B,EAGhD,GAAIa,IAAU,EACZ,MAAM,IAAI,MAAM,+CAA+C,EAajE,OAVoB,MAAME,EAAoB,CAC5C,YAAAvB,EACA,OAAQe,EAAO,eAAe,SAAS,EACvC,KAAM,CACJ,SAAU,GAAGT,CAAa,yBAC1B,kBAAmB,CAACC,EAAYyC,CAAe,CACjD,EACA,QAAA9B,CACF,CAAC,CAGH,CAQA,SAASiB,EAAgB3C,EAAoD,CAC3E,MAAO,CACL,GAAGA,EACH,qBAAsB,IAAI,KAAKA,EAAK,oBAAoB,EAAE,QAAQ,CACpE,CACF","names":["VALIDATION_RULES_DESCRIPTION","isValidANSSegment","fragment","isValidANSName","name","first","second","rest","LOCAL_ANS_ACCOUNT_PK","LOCAL_ANS_ACCOUNT_ADDRESS","NetworkToAnsContract","getRouterAddress","aptosConfig","address","unwrapOption","option","getOwnerAddress","args","routerAddress","domainName","subdomainName","res","view","owner","AccountAddress","registerName","expiration","sender","targetAddress","toAddress","options","transferable","hasSubdomainPolicy","years","registrationDuration","generateTransaction","tldExpiration","getExpiration","expirationDateInMillisecondsSinceEpoch","getPrimaryName","setPrimaryName","getTargetAddress","target","setTargetAddress","getName","queryIndexer","GetNames","sanitizeANSName","getAccountNames","accountAddress","expirationDate","getANSExpirationDate","getAccountDomains","getAccountSubdomains","getDomainSubdomains","domain","gracePeriodInSeconds","gracePeriodInDays","now","renewDomain","renewalDuration"]}
|