@aptos-labs/ts-sdk 1.25.0 → 1.26.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/cli/index.d.ts +32 -0
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.js +2 -2
- 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.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.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.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/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-WMBECPK5.mjs → chunk-2RCCHNYU.mjs} +2 -2
- package/dist/esm/{chunk-PYLB6CAF.mjs → chunk-2RO27Y23.mjs} +2 -2
- package/dist/esm/{chunk-34PNYV2Q.mjs → chunk-36KSOGK4.mjs} +2 -2
- package/dist/esm/{chunk-5JTED2JJ.mjs → chunk-3NRBTP3S.mjs} +2 -2
- package/dist/esm/{chunk-QRN6BG2N.mjs → chunk-3O7OEDTT.mjs} +2 -2
- package/dist/esm/{chunk-UEP4UQS5.mjs → chunk-3UV2Z2A4.mjs} +2 -2
- package/dist/esm/{chunk-M74WIV66.mjs → chunk-4MDBWSPX.mjs} +2 -2
- package/dist/esm/{chunk-NLJ5MHA5.mjs → chunk-5BSAUHMZ.mjs} +2 -2
- package/dist/esm/{chunk-UNMUX5HS.mjs → chunk-6MNATRA3.mjs} +2 -2
- package/dist/esm/{chunk-ISUHNAU4.mjs → chunk-76HTG7Z7.mjs} +2 -2
- package/dist/esm/{chunk-YB5DCDJY.mjs → chunk-A2SMIFMN.mjs} +2 -2
- package/dist/esm/{chunk-5OODQH42.mjs → chunk-AW2ARPK4.mjs} +2 -2
- package/dist/esm/{chunk-7JWCIWJ3.mjs → chunk-BTUJC43M.mjs} +2 -2
- package/dist/esm/{chunk-EMVWSYK5.mjs → chunk-C3DUPBSO.mjs} +2 -2
- package/dist/esm/{chunk-P2TDGITN.mjs → chunk-C7HIUK23.mjs} +2 -2
- package/dist/esm/{chunk-DPZO54DD.mjs → chunk-CTRLWMAG.mjs} +2 -2
- package/dist/esm/{chunk-HWX6AJJ2.mjs → chunk-D3M72WFO.mjs} +2 -2
- package/dist/esm/{chunk-GFUP6W3X.mjs → chunk-D7RK6FAB.mjs} +2 -2
- package/dist/esm/chunk-DDKAXJOY.mjs +2 -0
- package/dist/esm/{chunk-AZRXSMC2.mjs.map → chunk-DDKAXJOY.mjs.map} +1 -1
- package/dist/esm/{chunk-76IW7XM5.mjs → chunk-DLLNBXLZ.mjs} +2 -2
- package/dist/esm/{chunk-NAHOALKG.mjs → chunk-EC3JEZIB.mjs} +2 -2
- package/dist/esm/{chunk-NSEC2KVP.mjs → chunk-FETZGNB3.mjs} +2 -2
- package/dist/esm/{chunk-V3OYNKY5.mjs → chunk-G7UNU5GI.mjs} +2 -2
- package/dist/esm/{chunk-METR6A53.mjs → chunk-GG2DBDJT.mjs} +2 -2
- package/dist/esm/chunk-GIKRKT5B.mjs +2 -0
- package/dist/esm/{chunk-WLLWOD5T.mjs.map → chunk-GIKRKT5B.mjs.map} +1 -1
- package/dist/esm/{chunk-VL6JZUYX.mjs → chunk-GP4FRPJQ.mjs} +2 -2
- package/dist/esm/{chunk-6R3ZHOGL.mjs → chunk-GTFAH6VB.mjs} +2 -2
- package/dist/esm/{chunk-WMHYIP3S.mjs → chunk-GXTEJ7NO.mjs} +2 -2
- package/dist/esm/{chunk-EAWQ4SD3.mjs → chunk-H2QJOKSW.mjs} +2 -2
- package/dist/esm/{chunk-TDCS6MMG.mjs → chunk-IEGY7WEL.mjs} +2 -2
- package/dist/esm/{chunk-LKA54RAP.mjs → chunk-ITADRWJI.mjs} +2 -2
- package/dist/esm/{chunk-GY7ARJNT.mjs → chunk-ITMW7GWH.mjs} +2 -2
- package/dist/esm/{chunk-XSNOPUMC.mjs → chunk-IWBYKVXH.mjs} +2 -2
- package/dist/esm/{chunk-IDYCJIHI.mjs → chunk-JCPI7D7I.mjs} +2 -2
- package/dist/esm/{chunk-OGOWKEMD.mjs → chunk-KZY3TZVR.mjs} +2 -2
- package/dist/esm/{chunk-INZXND6M.mjs → chunk-LDTF3ABK.mjs} +2 -2
- package/dist/esm/{chunk-JCQYD2ZQ.mjs → chunk-LHJBQVU4.mjs} +2 -2
- package/dist/esm/{chunk-HKLJ6JKE.mjs → chunk-LN2AM5IU.mjs} +2 -2
- package/dist/esm/chunk-MLL54PYO.mjs +2 -0
- package/dist/esm/chunk-MLL54PYO.mjs.map +1 -0
- package/dist/esm/{chunk-HXYBTLQT.mjs → chunk-MRT63YLE.mjs} +2 -2
- package/dist/esm/{chunk-CZ6UX5WZ.mjs → chunk-N3PNKHCQ.mjs} +2 -2
- package/dist/esm/{chunk-FDFE5GY2.mjs → chunk-OMIBMVDW.mjs} +2 -2
- package/dist/esm/{chunk-KLD5S3J2.mjs → chunk-QEIKAT6S.mjs} +2 -2
- package/dist/esm/{chunk-EV5QBTUM.mjs → chunk-R3IDASOF.mjs} +2 -2
- package/dist/esm/{chunk-V75UHXGZ.mjs → chunk-R5Y36IYW.mjs} +2 -2
- package/dist/esm/{chunk-7VIABVKU.mjs → chunk-RXK5BSD6.mjs} +2 -2
- package/dist/esm/{chunk-XNSOEUH7.mjs → chunk-T4BJCVCN.mjs} +2 -2
- package/dist/esm/{chunk-7WPECE2S.mjs → chunk-T6VJAACM.mjs} +2 -2
- package/dist/esm/{chunk-2BJ23DXY.mjs → chunk-THRXIXIO.mjs} +1 -1
- package/dist/esm/{chunk-2BJ23DXY.mjs.map → chunk-THRXIXIO.mjs.map} +1 -1
- package/dist/esm/{chunk-35L6ZK2X.mjs → chunk-VHKT63N7.mjs} +2 -2
- package/dist/esm/{chunk-2CXQK6CH.mjs → chunk-VWGU7IB6.mjs} +2 -2
- package/dist/esm/{chunk-EFJCV23R.mjs → chunk-WGZZQQDK.mjs} +2 -2
- package/dist/esm/{chunk-BP7JPCSW.mjs → chunk-WS2XAD7R.mjs} +2 -2
- package/dist/esm/{chunk-F3RBTS5V.mjs → chunk-WYG7CP3N.mjs} +2 -2
- package/dist/esm/chunk-XCBLFSY5.mjs +2 -0
- package/dist/esm/chunk-XCBLFSY5.mjs.map +1 -0
- package/dist/esm/{chunk-E67RGLPK.mjs → chunk-XDDQWRYI.mjs} +2 -2
- package/dist/esm/{chunk-W7MX6GBC.mjs → chunk-YY7NLCQK.mjs} +2 -2
- package/dist/esm/{chunk-JBCUGFGG.mjs → chunk-ZBOD65DP.mjs} +2 -2
- package/dist/esm/{chunk-XJI57J4Q.mjs → chunk-ZDRXYQEE.mjs} +2 -2
- package/dist/esm/{chunk-MULJ2GLJ.mjs → chunk-ZXPBRVOA.mjs} +2 -2
- package/dist/esm/{chunk-3GGG4R4C.mjs → chunk-ZXSNAEPE.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +32 -0
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/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.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.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/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 +1 -1
- package/src/api/faucet.ts +3 -1
- package/src/cli/move.ts +80 -10
- package/src/transactions/transactionBuilder/transactionBuilder.ts +4 -1
- package/src/types/index.ts +1 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-AZRXSMC2.mjs +0 -2
- package/dist/esm/chunk-C4RTKCIA.mjs +0 -2
- package/dist/esm/chunk-C4RTKCIA.mjs.map +0 -1
- package/dist/esm/chunk-NWLLWPBG.mjs +0 -2
- package/dist/esm/chunk-NWLLWPBG.mjs.map +0 -1
- package/dist/esm/chunk-WLLWOD5T.mjs +0 -2
- /package/dist/esm/{chunk-WMBECPK5.mjs.map → chunk-2RCCHNYU.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYLB6CAF.mjs.map → chunk-2RO27Y23.mjs.map} +0 -0
- /package/dist/esm/{chunk-34PNYV2Q.mjs.map → chunk-36KSOGK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-5JTED2JJ.mjs.map → chunk-3NRBTP3S.mjs.map} +0 -0
- /package/dist/esm/{chunk-QRN6BG2N.mjs.map → chunk-3O7OEDTT.mjs.map} +0 -0
- /package/dist/esm/{chunk-UEP4UQS5.mjs.map → chunk-3UV2Z2A4.mjs.map} +0 -0
- /package/dist/esm/{chunk-M74WIV66.mjs.map → chunk-4MDBWSPX.mjs.map} +0 -0
- /package/dist/esm/{chunk-NLJ5MHA5.mjs.map → chunk-5BSAUHMZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UNMUX5HS.mjs.map → chunk-6MNATRA3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ISUHNAU4.mjs.map → chunk-76HTG7Z7.mjs.map} +0 -0
- /package/dist/esm/{chunk-YB5DCDJY.mjs.map → chunk-A2SMIFMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-5OODQH42.mjs.map → chunk-AW2ARPK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-7JWCIWJ3.mjs.map → chunk-BTUJC43M.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMVWSYK5.mjs.map → chunk-C3DUPBSO.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2TDGITN.mjs.map → chunk-C7HIUK23.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPZO54DD.mjs.map → chunk-CTRLWMAG.mjs.map} +0 -0
- /package/dist/esm/{chunk-HWX6AJJ2.mjs.map → chunk-D3M72WFO.mjs.map} +0 -0
- /package/dist/esm/{chunk-GFUP6W3X.mjs.map → chunk-D7RK6FAB.mjs.map} +0 -0
- /package/dist/esm/{chunk-76IW7XM5.mjs.map → chunk-DLLNBXLZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-NAHOALKG.mjs.map → chunk-EC3JEZIB.mjs.map} +0 -0
- /package/dist/esm/{chunk-NSEC2KVP.mjs.map → chunk-FETZGNB3.mjs.map} +0 -0
- /package/dist/esm/{chunk-V3OYNKY5.mjs.map → chunk-G7UNU5GI.mjs.map} +0 -0
- /package/dist/esm/{chunk-METR6A53.mjs.map → chunk-GG2DBDJT.mjs.map} +0 -0
- /package/dist/esm/{chunk-VL6JZUYX.mjs.map → chunk-GP4FRPJQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6R3ZHOGL.mjs.map → chunk-GTFAH6VB.mjs.map} +0 -0
- /package/dist/esm/{chunk-WMHYIP3S.mjs.map → chunk-GXTEJ7NO.mjs.map} +0 -0
- /package/dist/esm/{chunk-EAWQ4SD3.mjs.map → chunk-H2QJOKSW.mjs.map} +0 -0
- /package/dist/esm/{chunk-TDCS6MMG.mjs.map → chunk-IEGY7WEL.mjs.map} +0 -0
- /package/dist/esm/{chunk-LKA54RAP.mjs.map → chunk-ITADRWJI.mjs.map} +0 -0
- /package/dist/esm/{chunk-GY7ARJNT.mjs.map → chunk-ITMW7GWH.mjs.map} +0 -0
- /package/dist/esm/{chunk-XSNOPUMC.mjs.map → chunk-IWBYKVXH.mjs.map} +0 -0
- /package/dist/esm/{chunk-IDYCJIHI.mjs.map → chunk-JCPI7D7I.mjs.map} +0 -0
- /package/dist/esm/{chunk-OGOWKEMD.mjs.map → chunk-KZY3TZVR.mjs.map} +0 -0
- /package/dist/esm/{chunk-INZXND6M.mjs.map → chunk-LDTF3ABK.mjs.map} +0 -0
- /package/dist/esm/{chunk-JCQYD2ZQ.mjs.map → chunk-LHJBQVU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKLJ6JKE.mjs.map → chunk-LN2AM5IU.mjs.map} +0 -0
- /package/dist/esm/{chunk-HXYBTLQT.mjs.map → chunk-MRT63YLE.mjs.map} +0 -0
- /package/dist/esm/{chunk-CZ6UX5WZ.mjs.map → chunk-N3PNKHCQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-FDFE5GY2.mjs.map → chunk-OMIBMVDW.mjs.map} +0 -0
- /package/dist/esm/{chunk-KLD5S3J2.mjs.map → chunk-QEIKAT6S.mjs.map} +0 -0
- /package/dist/esm/{chunk-EV5QBTUM.mjs.map → chunk-R3IDASOF.mjs.map} +0 -0
- /package/dist/esm/{chunk-V75UHXGZ.mjs.map → chunk-R5Y36IYW.mjs.map} +0 -0
- /package/dist/esm/{chunk-7VIABVKU.mjs.map → chunk-RXK5BSD6.mjs.map} +0 -0
- /package/dist/esm/{chunk-XNSOEUH7.mjs.map → chunk-T4BJCVCN.mjs.map} +0 -0
- /package/dist/esm/{chunk-7WPECE2S.mjs.map → chunk-T6VJAACM.mjs.map} +0 -0
- /package/dist/esm/{chunk-35L6ZK2X.mjs.map → chunk-VHKT63N7.mjs.map} +0 -0
- /package/dist/esm/{chunk-2CXQK6CH.mjs.map → chunk-VWGU7IB6.mjs.map} +0 -0
- /package/dist/esm/{chunk-EFJCV23R.mjs.map → chunk-WGZZQQDK.mjs.map} +0 -0
- /package/dist/esm/{chunk-BP7JPCSW.mjs.map → chunk-WS2XAD7R.mjs.map} +0 -0
- /package/dist/esm/{chunk-F3RBTS5V.mjs.map → chunk-WYG7CP3N.mjs.map} +0 -0
- /package/dist/esm/{chunk-E67RGLPK.mjs.map → chunk-XDDQWRYI.mjs.map} +0 -0
- /package/dist/esm/{chunk-W7MX6GBC.mjs.map → chunk-YY7NLCQK.mjs.map} +0 -0
- /package/dist/esm/{chunk-JBCUGFGG.mjs.map → chunk-ZBOD65DP.mjs.map} +0 -0
- /package/dist/esm/{chunk-XJI57J4Q.mjs.map → chunk-ZDRXYQEE.mjs.map} +0 -0
- /package/dist/esm/{chunk-MULJ2GLJ.mjs.map → chunk-ZXPBRVOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-3GGG4R4C.mjs.map → chunk-ZXSNAEPE.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-GG2DBDJT.mjs";import{c as p}from"./chunk-NWOMSL6K.mjs";import{c as o}from"./chunk-T6VJAACM.mjs";import{n as u,q as g,r as A}from"./chunk-VHNX2NUR.mjs";import{f as a,i as r}from"./chunk-SUJLWCRN.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:g,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[{constraints:[]}],parameters:[p("0x1::object::Object"),new r,new a]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return c({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
|
|
2
|
+
//# sourceMappingURL=chunk-LN2AM5IU.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{spawn as i}from"child_process";import{platform as u}from"os";var c=class{async init(r){let{network:t,profile:a,extraArguments:e}=r,s=["aptos","init",`--network=${t??"local"}`,`--profile=${a??"default"}`];return e&&s.push(...e),this.runCommand(s)}async compile(r){let{packageDirectoryPath:t,namedAddresses:a,extraArguments:e}=r,s=["aptos","move","compile","--package-dir",t],d=this.parseNamedAddresses(a);return s.push(...this.prepareNamedAddresses(d)),e&&s.push(...e),this.runCommand(s)}async test(r){let{packageDirectoryPath:t,namedAddresses:a,extraArguments:e}=r,s=["aptos","move","test","--package-dir",t],d=this.parseNamedAddresses(a);return s.push(...this.prepareNamedAddresses(d)),e&&s.push(...e),this.runCommand(s)}async publish(r){let{packageDirectoryPath:t,namedAddresses:a,profile:e,extraArguments:s}=r,d=["aptos","move","publish","--package-dir",t,`--profile=${e??"default"}`],n=this.parseNamedAddresses(a);return d.push(...this.prepareNamedAddresses(n)),s&&d.push(...s),this.runCommand(d)}async createObjectAndPublishPackage(r){let{packageDirectoryPath:t,addressName:a,namedAddresses:e,profile:s,extraArguments:d}=r,n=["aptos","move","create-object-and-publish-package","--package-dir",t,"--address-name",a,`--profile=${s??"default"}`],o=this.parseNamedAddresses(e);n.push(...this.prepareNamedAddresses(o)),d&&n.push(...d);let p=await this.runCommand(n);return{objectAddress:this.extractAddressFromOutput(p.output)}}async upgradeObjectPackage(r){let{packageDirectoryPath:t,objectAddress:a,namedAddresses:e,profile:s,extraArguments:d}=r,n=["aptos","move","upgrade-object-package","--package-dir",t,"--object-address",a,`--profile=${s??"default"}`],o=this.parseNamedAddresses(e);return n.push(...this.prepareNamedAddresses(o)),d&&n.push(...d),this.runCommand(n)}async buildPublishPayload(r){let{outputFile:t,packageDirectoryPath:a,namedAddresses:e,extraArguments:s}=r,d=["aptos","move","build-publish-payload","--json-output-file",t,"--package-dir",a],n=this.parseNamedAddresses(e);return d.push(...this.prepareNamedAddresses(n)),s&&d.push(...s),this.runCommand(d)}async runScript(r){let{compiledScriptPath:t,profile:a,extraArguments:e}=r,s=["aptos","move","run-script","--compiled-script-path",t,`--profile=${a??"default"}`];return e&&s.push(...e),this.runCommand(s)}async runCommand(r){return new Promise((t,a)=>{let e=u(),s,d="";e==="win32"?s=i("npx",r,{shell:!0}):s=i("npx",r),s.stdout.on("data",n=>{d+=n.toString()}),s.stdout.pipe(process.stdout),s.stderr.pipe(process.stderr),process.stdin.pipe(s.stdin),s.on("close",n=>{n===0?t({output:d}):a(new Error(`Child process exited with code ${n}`))})})}prepareNamedAddresses(r){let t=r.size,a=[];if(t===0)return a;a.push("--named-addresses");let e=[];return r.forEach((s,d)=>{let n=`${d}=${s.toString()}`;e.push(n)}),a.push(e.join(",")),a}parseNamedAddresses(r){let t=new Map;return Object.keys(r).forEach(a=>{let e=r[a];t.set(a,e)}),t}extractAddressFromOutput(r){let t=r.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)\\.");if(t)return t[1];throw new Error("Failed to extract object address from output")}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MLL54PYO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async init(args: {\n network?: Network;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { network, profile, extraArguments } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\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 extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments } = 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 if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async test(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments } = 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 if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, profile, extraArguments } = 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 if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\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 extraArguments?: Array<string>;\n }): Promise<{ objectAddress: string }> {\n const { packageDirectoryPath, addressName, namedAddresses, profile, extraArguments } = 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 if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n const result = await this.runCommand(cliArgs);\n return { objectAddress: this.extractAddressFromOutput(result.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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile, extraArguments } = 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 if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs);\n }\n\n /**\n * Build a publication transaction payload and store it in a JSON output file\n *\n * @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)\n * @param args.outputFile Output file to write publication transaction to\n * @param args.namedAddresses Named addresses for the move binary\n * @example\n * {\n * alice:0x1234, bob:0x5678\n * }\n * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async buildPublishPayload(args: {\n packageDirectoryPath: string;\n outputFile: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n }) {\n const { outputFile, packageDirectoryPath, namedAddresses, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"build-publish-payload\",\n \"--json-output-file\",\n outputFile,\n \"--package-dir\",\n packageDirectoryPath,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\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 * @param args.extraArguments (optional) Any extra arguments to include in the form of an array of strings\n * @example\n * [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns stdout\n */\n async runScript(args: {\n compiledScriptPath: string;\n profile?: string;\n extraArguments?: Array<string>;\n }): Promise<{ output: string }> {\n const { compiledScriptPath, profile, extraArguments } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\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<{ output: 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({ output: 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 // eslint-disable-next-line class-methods-use-this\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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J,EAAQ,KAAKC,EAAM,KAAK,GAAG,CAAC,EACrBD,CACT,CASQ,oBAAoBf,EAA6E,CACvG,IAAMC,EAAe,IAAI,IAEzB,cAAO,KAAKD,CAAc,EAAE,QAASkB,GAAQ,CAC3C,IAAME,EAAUpB,EAAekB,CAAG,EAClCjB,EAAa,IAAIiB,EAAKE,CAAO,CAC/B,CAAC,EAEMnB,CACT,CASQ,yBAAyBoB,EAAwB,CACvD,IAAMC,EAAQD,EAAO,MAAM,sEAAsE,EACjG,GAAIC,EACF,OAAOA,EAAM,CAAC,EAEhB,MAAM,IAAI,MAAM,8CAA8C,CAChE,CACF","names":["spawn","platform","Move","args","network","profile","extraArguments","cliArgs","packageDirectoryPath","namedAddresses","addressesMap","addressName","result","objectAddress","outputFile","compiledScriptPath","resolve","reject","currentPlatform","childProcess","stdout","data","code","totalNames","newArgs","names","value","key","toAppend","address","output","match"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as e}from"./chunk-FETZGNB3.mjs";async function i(o){o.minimumLedgerVersion!==void 0&&await e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:o.processorType})}export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MRT63YLE.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as i}from"./chunk-GXTEJ7NO.mjs";import{a as e}from"./chunk-ITMW7GWH.mjs";import{a as r}from"./chunk-A63SMUOU.mjs";var n=class o extends r{constructor(t,a){super(),this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-N3PNKHCQ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as r,b as o,c as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as r,b as o,c as t}from"./chunk-JCPI7D7I.mjs";var i=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return o({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return t({aptosConfig:this.config,...e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OMIBMVDW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-ITADRWJI.mjs";import{a as c}from"./chunk-KZY3TZVR.mjs";import{c as i}from"./chunk-Q7MD4V7H.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QEIKAT6S.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,b as h}from"./chunk-C7HIUK23.mjs";import{b as m}from"./chunk-76OH2Z4Q.mjs";import{a as g}from"./chunk-MLDQ2TY2.mjs";import{a as b}from"./chunk-G5MGSV7Y.mjs";function d(l){let e=l;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var f=class l extends m{constructor(e){super();let{publicKeys:r,signaturesRequired:t}=e;if(t<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<t)throw new Error(`Provided ${r.length} public keys is smaller than the ${t} required signatures`);this.publicKeys=r.map(i=>i instanceof o?i:new o(i)),this.signaturesRequired=t}verifySignature(e){throw new Error("not implemented")}authKey(){return b.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(o),t=e.deserializeU8();return new l({publicKeys:r,signaturesRequired:t})}createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach((n,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(a.has(n))throw new Error(`Duplicate bit ${n} detected.`);a.add(n);let c=Math.floor(n/8),y=i[c];y|=t>>n%8,i[c]=y}),i}getIndex(e){let r=e instanceof o?e:new o(e),t=this.publicKeys.findIndex(i=>i.toString()===r.toString());if(t!==-1)return t;throw new Error("Public key not found in MultiKey")}},s=class s extends g{constructor(e){super();let{signatures:r,bitmap:t}=e;if(r.length>s.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${s.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(a=>a instanceof h?a:new h(a)),!(t instanceof Uint8Array))this.bitmap=s.createBitmap({bits:t});else{if(t.length!==s.BITMAP_LEN)throw new Error(`"bitmap" length should be ${s.BITMAP_LEN}`);this.bitmap=t}let i=this.bitmap.reduce((a,n)=>a+d(n),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,t=128,i=new Uint8Array([0,0,0,0]),a=new Set;return r.forEach(n=>{if(n>=s.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${s.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(n))throw new Error("Duplicate bits detected.");a.add(n);let u=Math.floor(n/8),c=i[u];c|=t>>n%8,i[u]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(h),t=e.deserializeBytes();return new s({signatures:r,bitmap:t})}};s.BITMAP_LEN=4,s.MAX_SIGNATURES_SUPPORTED=s.BITMAP_LEN*8;var p=s;export{f as a,p as b};
|
|
2
|
+
//# sourceMappingURL=chunk-R3IDASOF.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s,b as t,c as r,d as i,e as c,f as u,g as d,h as A,i as g,j as m,k as a,l as p,m as f,n as y,o as C,p as T,q as O}from"./chunk-XDDQWRYI.mjs";import{a as n}from"./chunk-MRT63YLE.mjs";import{e as o}from"./chunk-L36ZHC7J.mjs";var l=class{constructor(e){this.config=e}async getAccountInfo(e){return s({aptosConfig:this.config,...e})}async getAccountModules(e){return t({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return i({aptosConfig:this.config,...e})}async getAccountResources(e){return c({aptosConfig:this.config,...e})}async getAccountResource(e){return u({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),A({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),m({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),p({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),y({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),C({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:o,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),f({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),T({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return O({aptosConfig:this.config,...e})}};export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-R5Y36IYW.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t,b as n,c as o,d as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as t,b as n,c as o,d as r}from"./chunk-LN2AM5IU.mjs";import{a as s}from"./chunk-MRT63YLE.mjs";import{b as i}from"./chunk-OHRL766V.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-RXK5BSD6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-GG2DBDJT.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-T4BJCVCN.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l as c,v as n}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{l as c,v as n}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-A2SMIFMN.mjs";import{c as p}from"./chunk-4MDBWSPX.mjs";async function d(o){let{aptosConfig:s}=o,{data:e}=await i({aptosConfig:s,originMethod:"getLedgerInfo",path:""});return e}async function C(o){let{aptosConfig:s,limit:e}=o;return(await a({aptosConfig:s,query:{query:c,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function a(o){let{aptosConfig:s,query:e,originMethod:t}=o,{data:r}=await p({aptosConfig:s,originMethod:t??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function u(o){let{aptosConfig:s}=o;return(await a({aptosConfig:s,query:{query:n},originMethod:"getProcessorStatuses"})).processor_status}async function h(o){let s=await u({aptosConfig:o.aptosConfig});return BigInt(s[0].last_success_version)}async function T(o){let{aptosConfig:s,processorType:e}=o;return(await a({aptosConfig:s,query:{query:n,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{d as a,C as b,a as c,u as d,h as e,T as f};
|
|
2
|
+
//# sourceMappingURL=chunk-T6VJAACM.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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||{}),u=(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))(u||{}),d=(s=>(s[s.Script=0]="Script",s[s.EntryFunction=2]="EntryFunction",s[s.Multisig=3]="Multisig",s))(d||{}),c=(i=>(i[i.MultiAgentTransaction=0]="MultiAgentTransaction",i[i.FeePayerTransaction=1]="FeePayerTransaction",i))(c||{}),l=(r=>(r[r.Ed25519=0]="Ed25519",r[r.MultiEd25519=1]="MultiEd25519",r[r.MultiAgent=2]="MultiAgent",r[r.FeePayer=3]="FeePayer",r[r.SingleSender=4]="SingleSender",r))(l||{}),_=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(_||{}),x=(s=>(s[s.Ed25519=0]="Ed25519",s[s.Secp256k1=1]="Secp256k1",s[s.Keyless=3]="Keyless",s))(x||{}),h=(s=>(s[s.Ed25519=0]="Ed25519",s[s.Secp256k1=1]="Secp256k1",s[s.Keyless=3]="Keyless",s))(h||{}),v=(p=>(p[p.Ed25519=0]="Ed25519",p))(v||{}),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.BlockEpilogue="block_epilogue_transaction",a))(b||{});function U(n){return n.type==="pending_transaction"}function W(n){return n.type==="user_transaction"}function F(n){return n.type==="genesis_transaction"}function I(n){return n.type==="block_metadata_transaction"}function B(n){return n.type==="state_checkpoint_transaction"}function A(n){return n.type==="validator_transaction"}function P(n){return n.type==="block_epilogue_transaction"}function G(n){return"signature"in n&&n.signature==="ed25519_signature"}function O(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function D(n){return n.type==="multi_agent_signature"}function N(n){return n.type==="fee_payer_signature"}function q(n){return n.type==="multi_ed25519_signature"}var k=(s=>(s.PRIVATE="private",s.PUBLIC="public",s.FRIEND="friend",s))(k||{}),S=(e=>(e.STORE="store",e.DROP="drop",e.KEY="key",e.COPY="copy",e))(S||{}),f=(i=>(i.VALIDATOR="validator",i.FULL_NODE="full_node",i))(f||{}),C=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(C||{}),T=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",i))(T||{}),E=(r=>(r[r.DeriveAuid=251]="DeriveAuid",r[r.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",r[r.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",r[r.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",r[r.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",r))(E||{});export{g as a,y as b,u as c,d,c as e,l as f,_ as g,x as h,h as i,v as j,M as k,m as l,R as m,b as n,U as o,W as p,F as q,I as r,B as s,A as t,P as u,G as v,O as w,D as x,N as y,q as z,k as A,S as B,f as C,C as D,T as E,E as F};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-THRXIXIO.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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 BlockEpilogue = \"block_epilogue_transaction\",\n}\n\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse\n | BlockEpilogueTransactionResponse;\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 function isBlockEpilogueTransactionResponse(\n response: TransactionResponse,\n): response is BlockEpilogueTransactionResponse {\n return response.type === TransactionResponseType.BlockEpilogue;\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 * BlockEndInfo describes the gas state of the block\n */\nexport type BlockEndInfo = {\n block_gas_limit_reached: boolean;\n block_output_limit_reached: boolean;\n block_effective_block_gas_units: number;\n block_approx_output_size: number;\n};\n\n/**\n * BlockEpilogueTransactionResponse is a transaction that is executed at the end of a block keeping track of data from\n * the whole block\n */\nexport type BlockEpilogueTransactionResponse = {\n type: TransactionResponseType.BlockEpilogue;\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 block_end_info: BlockEndInfo | null;\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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IAA,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","isBlockEpilogueTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
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 BlockEpilogue = \"block_epilogue_transaction\",\n}\n\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse\n | BlockEpilogueTransactionResponse;\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 function isBlockEpilogueTransactionResponse(\n response: TransactionResponse,\n): response is BlockEpilogueTransactionResponse {\n return response.type === TransactionResponseType.BlockEpilogue;\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 * BlockEndInfo describes the gas state of the block\n */\nexport type BlockEndInfo = {\n block_gas_limit_reached: boolean;\n block_output_limit_reached: boolean;\n block_effective_block_gas_units: number;\n block_approx_output_size: number;\n};\n\n/**\n * BlockEpilogueTransactionResponse is a transaction that is executed at the end of a block keeping track of data from\n * the whole block\n */\nexport type BlockEpilogueTransactionResponse = {\n type: TransactionResponseType.BlockEpilogue;\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 block_end_info: BlockEndInfo | null;\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 // Default behavior is to wait for the indexer. Set this to false to disable waiting.\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,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A4DAC,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","isBlockEpilogueTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as d}from"./chunk-T6VJAACM.mjs";import{p as c}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-OHRL766V.mjs";var a=300,u=t=>{if(t&&t.length>a)throw new Error(`Event type length exceeds the maximum length of ${a}`)};async function m(t){let{aptosConfig:o,eventType:e,options:n}=t;return p({aptosConfig:o,options:{...n,where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}}}})}async function f(t){let{accountAddress:o,aptosConfig:e,creationNumber:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function _(t){let{accountAddress:o,aptosConfig:e,eventType:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},indexed_type:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function p(t){let{aptosConfig:o,options:e}=t;u(e?.where?.indexed_type?._eq);let n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:o,query:n,originMethod:"getEvents"})).events}export{m as a,f as b,_ as c,p as d};
|
|
2
|
+
//# sourceMappingURL=chunk-VHKT63N7.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as n}from"./chunk-T6VJAACM.mjs";import{o as g,t as d}from"./chunk-VHNX2NUR.mjs";import{b as s}from"./chunk-OHRL766V.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
|
|
2
|
+
//# sourceMappingURL=chunk-VWGU7IB6.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-EC3JEZIB.mjs";import{a as l}from"./chunk-GIKRKT5B.mjs";import{a as f}from"./chunk-RXK5BSD6.mjs";import{a as g}from"./chunk-3UV2Z2A4.mjs";import{a as u}from"./chunk-OMIBMVDW.mjs";import{a as A}from"./chunk-LHJBQVU4.mjs";import{a as h}from"./chunk-CTRLWMAG.mjs";import{a as y}from"./chunk-DLLNBXLZ.mjs";import{a as s}from"./chunk-R5Y36IYW.mjs";import{a as p}from"./chunk-WYG7CP3N.mjs";import{a as d}from"./chunk-NMD45OTM.mjs";import{a as r}from"./chunk-6MNATRA3.mjs";import{a}from"./chunk-ZDRXYQEE.mjs";import{a as c}from"./chunk-36KSOGK4.mjs";var t=class{constructor(n){this.config=new d(n),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new l(this.config),this.fungibleAsset=new f(this.config),this.general=new g(this.config),this.staking=new h(this.config),this.transaction=new m(this.config),this.table=new y(this.config),this.keyless=new u(this.config),this.object=new A(this.config)}};function e(b,n,w){Object.getOwnPropertyNames(n.prototype).forEach(i=>{let o=Object.getOwnPropertyDescriptor(n.prototype,i);o&&(o.value=function(...j){return this[w][i](...j)},Object.defineProperty(b.prototype,i,o))})}e(t,s,"account");e(t,p,"ans");e(t,r,"coin");e(t,a,"digitalAsset");e(t,c,"event");e(t,l,"faucet");e(t,f,"fungibleAsset");e(t,g,"general");e(t,h,"staking");e(t,m,"transaction");e(t,y,"table");e(t,u,"keyless");e(t,A,"object");export{t as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WGZZQQDK.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as T}from"./chunk-XUT73RUR.mjs";import{d as v}from"./chunk-YTQVMLFD.mjs";import{a as b,b as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as T}from"./chunk-XUT73RUR.mjs";import{d as v}from"./chunk-YTQVMLFD.mjs";import{a as b,b as x}from"./chunk-3NRBTP3S.mjs";import{d as g}from"./chunk-ZXSNAEPE.mjs";import{a as y,b as m}from"./chunk-C7HIUK23.mjs";import{i as A,j as F,k as E,n as f}from"./chunk-YY7NLCQK.mjs";import{b as S}from"./chunk-OHRL766V.mjs";import{a as w}from"./chunk-DZXM2MQY.mjs";import{a as d}from"./chunk-A63SMUOU.mjs";import{b as K}from"./chunk-BCUSI3N6.mjs";import{jwtDecode as z}from"jwt-decode";import Z from"eventemitter3";var o=class o extends d{constructor(e){super();let{address:r,ephemeralKeyPair:t,uidKey:i,uidVal:a,aud:c,pepper:p,proof:n,proofFetchCallback:s,jwt:l}=e;if(this.ephemeralKeyPair=t,this.publicKey=A.create(e),this.accountAddress=r?S.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=i,this.uidVal=a,this.aud=c,this.jwt=l,this.emitter=new Z,this.proofOrPromise=n,n instanceof f)this.proof=n;else{if(s===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async u=>{await s(u),this.emitter.removeAllListeners()}),this.init(n)}this.signingScheme=2;let h=K.fromHexInput(p).toUint8Array();if(h.length!==o.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${o.PEPPER_LENGTH}`);this.pepper=h}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),t=e.deserializeStr(),i=e.deserializeFixedBytes(31),a=T.deserialize(e),c=f.deserialize(e);return o.create({proof:c,pepper:i,uidKey:t,jwt:r,ephemeralKeyPair:a})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let r=new m(this.sign(e)),t=new y(this.publicKey);return new g(t,r)}signTransactionWithAuthenticator(e){let r=new m(this.signTransaction(e)),t=new y(this.publicKey);return new g(t,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let t=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new F({jwtHeader:v(this.jwt.split(".")[0]),ephemeralCertificate:new E(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:t,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=b(e),i=new P(r,this.proof.proof).hash();return this.sign(i)}verifySignature(e){let{message:r,signature:t}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:t.ephemeralSignature}))}static fromBytes(e){return o.deserialize(new w(e))}static create(e){let{address:r,proof:t,jwt:i,ephemeralKeyPair:a,pepper:c,uidKey:p="sub",proofFetchCallback:n}=e,s=z(i),l=s.iss;if(typeof s.aud!="string")throw new Error("aud was not found or an array of values");let h=s.aud,u=s[p];return new o({address:r,proof:t,ephemeralKeyPair:a,iss:l,uidKey:p,uidVal:u,aud:h,pepper:c,jwt:i,proofFetchCallback:n})}};o.PEPPER_LENGTH=31;var k=o,P=class extends d{constructor(r,t){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=r,this.proof=t}serialize(r){r.serializeFixedBytes(this.transaction.bcsToBytes()),r.serializeOption(this.proof)}hash(){return x(this.bcsToBytes(),this.domainSeparator)}};export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-WS2XAD7R.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-3O7OEDTT.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-WYG7CP3N.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as T,c as en,d as an,e as R}from"./chunk-2RCCHNYU.mjs";import{r as tn,u as f}from"./chunk-G7UNU5GI.mjs";import{a as Y}from"./chunk-XDDQWRYI.mjs";import{b as nn}from"./chunk-FETZGNB3.mjs";import{a as Q}from"./chunk-T6VJAACM.mjs";import{a as J}from"./chunk-76HTG7Z7.mjs";import{a as y}from"./chunk-N3PNKHCQ.mjs";import{a as j}from"./chunk-ZXPBRVOA.mjs";import{a as z,c as L,d as Z}from"./chunk-GXTEJ7NO.mjs";import{c as K,d as O,e as V,f as x,g as q,h as H,i as X}from"./chunk-LDTF3ABK.mjs";import{b as E,d as B,e as F,f as D}from"./chunk-ITMW7GWH.mjs";import{a as v}from"./chunk-BOYYQAB4.mjs";import{a as k,b as l,d as A}from"./chunk-ZXSNAEPE.mjs";import{a as b,b as p}from"./chunk-C7HIUK23.mjs";import{a as N}from"./chunk-O4BBULNE.mjs";import{i as S,j as _}from"./chunk-YY7NLCQK.mjs";import{b as $,d as M}from"./chunk-Q7MD4V7H.mjs";import{b as u}from"./chunk-OHRL766V.mjs";import{a as C}from"./chunk-AH44UPM4.mjs";import{a as U}from"./chunk-WV5AD4IE.mjs";import{b as I}from"./chunk-BCUSI3N6.mjs";import{g as P}from"./chunk-SCHZ67F3.mjs";import{b as W,c as G}from"./chunk-L36ZHC7J.mjs";import{sha3_256 as dn}from"@noble/hashes/sha3";async function vn(n){if(tn(n))return yn(n);let{moduleAddress:t,moduleName:e,functionName:i}=f(n.function),a=await on({key:"entry-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:en});return mn({...n,abi:a})}function mn(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(n.function),r=T(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n.functionArguments.map((s,d)=>R(n.function,t,s,d,r));if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);let c=x.build(`${e}::${i}`,a,r,o);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new V(new H(s,new X(c)))}return new O(c)}async function Kn(n){let{moduleAddress:t,moduleName:e,functionName:i}=f(n.function),a=await on({key:"view-function",moduleAddress:t,moduleName:e,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:an});return An({abi:a,...n})}function An(n){let t=n.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(n.function),r=T(n.typeArguments);if(r.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${r.length}`);let o=n?.functionArguments?.map((c,s)=>R(n.function,t,c,s,r))??[];if(o.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${t.parameters.length} but got ${o.length}`);return x.build(`${e}::${i}`,a,r,o)}function yn(n){return new K(new q(I.fromHexInput(n.bytecode).toUint8Array(),T(n.typeArguments),n.functionArguments))}async function fn(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=async()=>P[t.network]?{chainId:P[t.network]}:{chainId:(await Q({aptosConfig:t})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await nn({aptosConfig:t})).gas_estimate},s=async()=>{let g=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:(await Y({aptosConfig:t,accountAddress:e})).sequence_number;if(r&&u.from(r).equals(u.ZERO))try{return await g()}catch{return 0}else return g()},[{chainId:d},{gasEstimate:m},w]=await Promise.all([o(),c(),s()]),{maxGasAmount:sn,gasUnitPrice:cn,expireTimestamp:un}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(2e5),gasUnitPrice:a?.gasUnitPrice??BigInt(m),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new z(u.from(e),BigInt(w),i,BigInt(sn),BigInt(cn),BigInt(un),new v(d))}async function On(n){let{aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r}=n,o=await fn({aptosConfig:t,sender:e,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new J(o,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new j(o,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Vn(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:i,feePayerPublicKey:a}=n,r=h(t);if(e.feePayerAddress){let c=new Z(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),s=[];i&&(s=i.map(w=>h(w)));let d=h(a),m=new F(r,e.secondarySignerAddresses??[],s,{address:e.feePayerAddress,authenticator:d});return new y(c.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let c=new L(e.rawTransaction,e.secondarySignerAddresses),s=[];s=i.map(m=>h(m));let d=new B(r,e.secondarySignerAddresses,s);return new y(c.raw_txn,d).bcsToBytes()}let o;if(r instanceof l)o=new E(r.public_key,r.signature);else if(r instanceof A)o=new D(r);else throw new Error("Invalid public key");return new y(e.rawTransaction,o).bcsToBytes()}function h(n){let t=new M(new Uint8Array(64));if($.isInstance(n))return new l(n,t);if(b.isInstance(n))return S.isInstance(n.publicKey)?new A(n,new p(_.getSimulationSignature())):new A(n,new p(t));if(S.isInstance(n)||N.isInstance(n))return console.warn("Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey."),new A(new b(n),new p(t));throw new Error("Unsupported public key")}function gn(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:i}=n,a=U(k,n.senderAuthenticator),r;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new F(a,t.secondarySignerAddresses??[],i??[],{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new B(a,t.secondarySignerAddresses,i)}else a instanceof l?r=new E(a.public_key,a.signature):r=new D(a);return new y(t.rawTransaction,r).bcsToBytes()}function rn(n){let t=dn.create();for(let e of n)t.update(e);return t.digest()}var pn=rn(["APTOS::Transaction"]);function qn(n){let t=gn(n);return new I(rn([pn,new Uint8Array([0]),t])).toString()}async function on({key:n,moduleAddress:t,moduleName:e,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:C(async()=>o(t,e,i,a),`${n}-${a.network}-${t}-${e}-${i}`,1e3*60*5)()}export{vn as a,mn as b,Kn as c,An as d,fn as e,On as f,Vn as g,h,gn as i,rn as j,qn as k};
|
|
2
|
+
//# sourceMappingURL=chunk-XCBLFSY5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport { AnyPublicKey, AnySignature, KeylessPublicKey, KeylessSignature, Secp256k1PublicKey } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport { DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW } from \"../../utils/const\";\nimport { normalizeBundle } from \"../../utils/normalizeBundle\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticator,\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n InputGenerateTransactionOptions,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n InputViewFunctionDataWithRemoteABI,\n InputViewFunctionDataWithABI,\n FunctionABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransactionPayload` function.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"entry-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchEntryFunctionAbi,\n });\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ ...args, abi: functionAbi });\n}\n\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\nexport async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"view-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchViewFunctionAbi,\n });\n\n // Fill in the ABI\n return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\nexport function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> =\n args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);\n}\n\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(\n Hex.fromHexInput(args.bytecode).toUint8Array(),\n standardizeTypeTags(args.typeArguments),\n args.functionArguments,\n ),\n );\n}\n\n/**\n * Generates a raw transaction\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n *\n * @returns RawTransaction\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n const getChainId = async () => {\n if (NetworkToChainId[aptosConfig.network]) {\n return { chainId: NetworkToChainId[aptosConfig.network] };\n }\n const info = await getLedgerInfo({ aptosConfig });\n return { chainId: info.chain_id };\n };\n\n const getGasUnitPrice = async () => {\n if (options?.gasUnitPrice) {\n return { gasEstimate: options.gasUnitPrice };\n }\n const estimation = await getGasPriceEstimation({ aptosConfig });\n return { gasEstimate: estimation.gas_estimate };\n };\n\n const getSequenceNumberForAny = async () => {\n const getSequenceNumber = async () => {\n if (options?.accountSequenceNumber !== undefined) {\n return options.accountSequenceNumber;\n }\n\n return (await getInfo({ aptosConfig, accountAddress: sender })).sequence_number;\n };\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n return await getSequenceNumber();\n } catch (e: any) {\n return 0;\n }\n } else {\n return getSequenceNumber();\n }\n };\n const [{ chainId }, { gasEstimate }, sequenceNumber] = await Promise.all([\n getChainId(),\n getGasUnitPrice(),\n getSequenceNumberForAny(),\n ]);\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),\n expireTimestamp: options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransaction` function.\n * When we call our `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return new MultiAgentTransaction(\n rawTxn,\n signers,\n args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n );\n }\n // return the raw transaction\n return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);\n}\n\n/**\n * Simulate a transaction before signing and submit to chain\n *\n * @param args.transaction A aptos transaction type to sign\n * @param args.signerPublicKey The signer public key\n * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction\n * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction\n * @param args.options optional. SimulateTransactionOptions\n *\n * @returns A signed serialized transaction that can be simulated\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey!);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys!.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (accountAuthenticator instanceof AccountAuthenticatorSingleKey) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\n // No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid\n const invalidSignature = new Ed25519Signature(new Uint8Array(64));\n\n if (Ed25519PublicKey.isInstance(publicKey)) {\n return new AccountAuthenticatorEd25519(publicKey, invalidSignature);\n }\n\n if (AnyPublicKey.isInstance(publicKey)) {\n if (KeylessPublicKey.isInstance(publicKey.publicKey)) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));\n }\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(invalidSignature));\n }\n\n // TODO: remove this, non-account public keys should never make it here\n if (KeylessPublicKey.isInstance(publicKey) || Secp256k1PublicKey.isInstance(publicKey)) {\n // eslint-disable-next-line no-console\n console.warn(\"Expected AccountPublicKey, but got PublicKey. Please wrap your public key with AnyPublicKey.\");\n return new AccountAuthenticatorSingleKey(new AnyPublicKey(publicKey), new AnySignature(invalidSignature));\n }\n\n // TODO add support for AnyMultiKey\n throw new Error(\"Unsupported public key\");\n}\n\n/**\n * Prepare a transaction to be submitted to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @returns A SignedTransaction\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n const senderAuthenticator = normalizeBundle(AccountAuthenticator, args.senderAuthenticator);\n\n let txnAuthenticator: TransactionAuthenticator;\n if (transaction.feePayerAddress) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n txnAuthenticator = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n } else if (transaction.secondarySignerAddresses) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n txnAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondarySignerAddresses,\n additionalSignersAuthenticators,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorEd25519) {\n txnAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else {\n txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n }\n\n return new SignedTransaction(transaction.rawTransaction, txnAuthenticator).bcsToBytes();\n}\n\n/**\n * Hashes the set of values with a SHA-3 256 hash\n * @param input array of UTF-8 strings or Uint8array byte arrays\n */\nexport function hashValues(input: (Uint8Array | string)[]): Uint8Array {\n const hash = sha3Hash.create();\n for (const item of input) {\n hash.update(item);\n }\n return hash.digest();\n}\n\n/**\n * The domain separated prefix for hashing transacitons\n */\nconst TRANSACTION_PREFIX = hashValues([\"APTOS::Transaction\"]);\n\n/**\n * Generates a user transaction hash for the given transaction payload. It must already have an authenticator\n * @param args InputSubmitTransactionData\n */\nexport function generateUserTransactionHash(args: InputSubmitTransactionData): string {\n const signedTransaction = generateSignedTransaction(args);\n\n // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)\n // Then followed by the type of the transaction for the enum, UserTransaction is 0\n // Then followed by BCS encoded bytes of the signed transaction\n return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();\n}\n\n/**\n * Fetches and caches ABIs with allowing for pass-through on provided ABIs\n * @param key\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n * @param abi\n * @param fetch\n */\nasync function fetchAbi<T extends FunctionABI>({\n key,\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig,\n abi,\n fetch,\n}: {\n key: string;\n moduleAddress: string;\n moduleName: string;\n functionName: string;\n aptosConfig: AptosConfig;\n abi?: T;\n fetch: (moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig) => Promise<T>;\n}): Promise<T> {\n if (abi !== undefined) {\n return abi;\n }\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n return memoizeAsync(\n async () => fetch(moduleAddress, moduleName, functionName, aptosConfig),\n `${key}-${aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n"],"mappings":"skCAQA,OAAS,YAAYA,OAAgB,qBAwFrC,eAAsBC,GACpBC,EACwC,CACxC,GAAIC,GAAkBD,CAAI,EACxB,OAAOE,GAAiCF,CAAI,EAE9C,GAAM,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAE5EO,EAAc,MAAMC,GAAS,CACjC,IAAK,iBACL,cAAAL,EACA,WAAAC,EACA,aAAAC,EACA,YAAaL,EAAK,YAClB,IAAKA,EAAK,IACV,MAAOS,EACT,CAAC,EAGD,OAAOC,GAAkC,CAAE,GAAGV,EAAM,IAAKO,CAAY,CAAC,CACxE,CAIO,SAASG,GACdV,EAC+B,CAC/B,IAAMO,EAAcP,EAAK,IACnB,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAG5EW,EAAgBC,EAAoBZ,EAAK,aAAa,EAG5D,GAAIW,EAAc,SAAWJ,EAAY,eAAe,OACtD,MAAM,IAAI,MACR,0CAA0CA,EAAY,eAAe,MAAM,cAAcI,EAAc,MAAM,EAC/G,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AoB,CAAC,EAMrD,SAASM,GAA4BpG,EAA0C,CACpF,IAAMqG,EAAoBb,GAA0BxF,CAAI,EAKxD,OAAO,IAAI8B,EAAIgE,GAAW,CAACK,GAAoB,IAAI,WAAW,CAAC,CAAC,CAAC,EAAGE,CAAiB,CAAC,CAAC,EAAE,SAAS,CACpG,CAYA,eAAe7F,GAAgC,CAC7C,IAAA8F,EACA,cAAAnG,EACA,WAAAC,EACA,aAAAC,EACA,YAAA2B,EACA,IAAAuE,EACA,MAAAC,CACF,EAQe,CACb,OAAID,IAAQ,OACHA,EAIFE,EACL,SAAYD,EAAMrG,EAAeC,EAAYC,EAAc2B,CAAW,EACtE,GAAGsE,CAAG,IAAItE,EAAY,OAAO,IAAI7B,CAAa,IAAIC,CAAU,IAAIC,CAAY,GAC5E,IAAO,GAAK,CACd,EAAE,CACJ","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","fetchAbi","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultiSig","MultiSig","MultiSigTransactionPayload","TransactionPayloadEntryFunction","generateViewFunctionPayload","fetchViewFunctionAbi","generateViewFunctionPayloadWithABI","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","getSequenceNumberForAny","getSequenceNumber","getInfo","chainId","gasEstimate","sequenceNumber","maxGasAmount","gasUnitPrice","expireTimestamp","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","MultiAgentTransaction","SimpleTransaction","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","TransactionAuthenticatorSingleSender","invalidSignature","Ed25519Signature","Ed25519PublicKey","AnyPublicKey","KeylessPublicKey","AnySignature","KeylessSignature","Secp256k1PublicKey","generateSignedTransaction","additionalSignersAuthenticators","senderAuthenticator","normalizeBundle","AccountAuthenticator","txnAuthenticator","hashValues","input","hash","sha3Hash","item","TRANSACTION_PREFIX","generateUserTransactionHash","signedTransaction","key","abi","fetch","memoizeAsync"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as K}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as K}from"./chunk-BTUJC43M.mjs";import{c as d}from"./chunk-T6VJAACM.mjs";import{d as b,e as v,f as q,g as O,i as P,j as S,k as M,u as G}from"./chunk-VHNX2NUR.mjs";import{a as f}from"./chunk-QEIKAT6S.mjs";import{a as k}from"./chunk-WRRQ7L5K.mjs";import{a as T}from"./chunk-C7HIUK23.mjs";import{b as C}from"./chunk-O4BBULNE.mjs";import{c as _}from"./chunk-Q7MD4V7H.mjs";import{a as g}from"./chunk-G5MGSV7Y.mjs";import{b as i}from"./chunk-OHRL766V.mjs";import{a as w}from"./chunk-AH44UPM4.mjs";import{b as A,d as p}from"./chunk-A2SMIFMN.mjs";import{a as h}from"./chunk-TDGQGILY.mjs";import{e as y}from"./chunk-L36ZHC7J.mjs";async function R(o){let{aptosConfig:n,accountAddress:t}=o,{data:e}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return e}async function Y(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??1e3}})}async function Z(o){return o.options?.ledgerVersion!==void 0?Q(o):w(async()=>Q(o),`module-${o.accountAddress}-${o.moduleName}`,1e3*60*5)()}async function Q(o){let{aptosConfig:n,accountAddress:t,moduleName:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${e}`,params:{ledger_version:r?.ledgerVersion}});return s}async function ee(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:e?.offset,limit:e?.limit}})}async function oe(o){let{aptosConfig:n,accountAddress:t,options:e}=o;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:e?.ledgerVersion,start:e?.offset,limit:e?.limit??999}})}async function x(o){let{aptosConfig:n,accountAddress:t,resourceType:e,options:r}=o,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${e}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function L(o){let{aptosConfig:n,authenticationKey:t,options:e}=o,r=await x({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:e}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await K({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:e});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function te(o){let{aptosConfig:n,accountAddress:t}=o,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:S,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function ne(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard});let c={query:O,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function re(o){let{aptosConfig:n,accountAddress:t,collectionAddress:e,options:r}=o,s=i.from(t).toStringLong(),c=i.from(e).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:P,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function se(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}};e?.tokenStandard&&(s.current_collection={token_standard:{_eq:e?.tokenStandard}});let c={query:q,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ce(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:M,variables:{address:e}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function ie(o){let{aptosConfig:n,accountAddress:t,coinType:e,faMetadataAddress:r}=o,s,c;if(e!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(e!==void 0&&r===void 0)s=e,o.coinType===y?c=i.A.toStringLong():c=k(i.A,e).toStringLong();else if(e===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=y)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};e!==void 0&&(u={asset_type:{_in:[s,c]}});let l=await B({aptosConfig:n,accountAddress:a,options:{where:u}});return l[0]?l[0].amount:0}async function B(o){let{aptosConfig:n,accountAddress:t,options:e}=o,r=i.from(t).toStringLong(),s={...e?.where,owner_address:{_eq:r}},c={query:v,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ae(o){let{aptosConfig:n,accountAddress:t}=o,e=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:b,variables:{address:e}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function de(o){let{aptosConfig:n,accountAddress:t,options:e}=o,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:G,variables:{where_condition:s,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function ue(o){let{aptosConfig:n,privateKey:t}=o,e=new T(t.publicKey());if(t instanceof C){let s=g.fromPublicKey({publicKey:e}).derivedAddress();return f.fromPrivateKey({privateKey:t,address:s})}if(t instanceof _){let r=g.fromPublicKey({publicKey:e});if(await I({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:e.publicKey});if(await I({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function I(o){let{aptosConfig:n,authKey:t}=o,e=await L({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await R({aptosConfig:n,accountAddress:e}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${e.toString()}`)}}export{R as a,Y as b,Z as c,ee as d,oe as e,x as f,L as g,te as h,ne as i,re as j,se as k,ce as l,ie as m,B as n,ae as o,de as p,ue as q,I as r};
|
|
2
|
+
//# sourceMappingURL=chunk-XDDQWRYI.mjs.map
|