@aptos-labs/ts-sdk 1.13.3 → 1.14.0-zeta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/accountAddress-NPQwRmxn.d.ts +2121 -0
- package/dist/common/cli/index.d.ts +94 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +2588 -4127
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account--qjfup2u.d.mts → Ed25519Account-9zBaZEnp.d.mts} +76 -9
- package/dist/esm/account/Account.d.mts +34 -0
- package/dist/esm/account/Account.mjs +2 -0
- package/dist/esm/account/Ed25519Account.d.mts +34 -0
- package/dist/esm/account/Ed25519Account.mjs +2 -0
- package/dist/esm/account/EphemeralKeyPair.d.mts +47 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +107 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +134 -0
- package/dist/esm/account/MultiKeyAccount.mjs +2 -0
- package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
- package/dist/esm/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/account/index.d.mts +40 -0
- package/dist/esm/account/index.mjs +2 -0
- package/dist/esm/api/account.d.mts +13 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +14 -8
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +7 -7
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +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.d.mts +5 -5
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +7 -7
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +13 -8
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +67 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
- 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/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +2 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-IKYIJYBY.mjs → chunk-25N7RLBW.mjs} +2 -2
- package/dist/esm/chunk-25N7RLBW.mjs.map +1 -0
- package/dist/esm/chunk-32355KGV.mjs +2 -0
- package/dist/esm/chunk-32355KGV.mjs.map +1 -0
- package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-3FVRXELT.mjs} +2 -2
- package/dist/esm/chunk-3OELNIC6.mjs +2 -0
- package/dist/esm/{chunk-734YX27W.mjs.map → chunk-3OELNIC6.mjs.map} +1 -1
- package/dist/esm/chunk-3U5VRZLS.mjs +2 -0
- package/dist/esm/chunk-3U5VRZLS.mjs.map +1 -0
- package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-3VGX3TXH.mjs} +2 -2
- package/dist/esm/chunk-43WARVT3.mjs +2 -0
- package/dist/esm/chunk-43WARVT3.mjs.map +1 -0
- package/dist/esm/{chunk-CU67XZNB.mjs → chunk-52ECIIIH.mjs} +2 -2
- package/dist/esm/chunk-56NB52W6.mjs +2 -0
- package/dist/esm/chunk-56NB52W6.mjs.map +1 -0
- package/dist/esm/chunk-5DW2AJPI.mjs +2 -0
- package/dist/esm/chunk-5DW2AJPI.mjs.map +1 -0
- package/dist/esm/chunk-5QWUIVAQ.mjs +2 -0
- package/dist/esm/chunk-5QWUIVAQ.mjs.map +1 -0
- package/dist/esm/chunk-6456EI2E.mjs +2 -0
- package/dist/esm/chunk-6456EI2E.mjs.map +1 -0
- package/dist/esm/{chunk-Q3TZGQVC.mjs → chunk-65UZZNN2.mjs} +2 -2
- package/dist/esm/chunk-65UZZNN2.mjs.map +1 -0
- package/dist/esm/{chunk-MFKMAAWA.mjs → chunk-6LOTZ4GY.mjs} +2 -2
- package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-6RBUXB5I.mjs} +2 -2
- package/dist/esm/{chunk-IIPYR7PF.mjs → chunk-6SHLLRJA.mjs} +2 -2
- package/dist/esm/chunk-6SHLLRJA.mjs.map +1 -0
- package/dist/esm/chunk-73Y4NTDU.mjs +2 -0
- package/dist/esm/chunk-73Y4NTDU.mjs.map +1 -0
- package/dist/esm/chunk-7PSX4LCV.mjs +2 -0
- package/dist/esm/{chunk-B7TQGVGL.mjs.map → chunk-7PSX4LCV.mjs.map} +1 -1
- package/dist/esm/chunk-7Q2NVO5M.mjs +2 -0
- package/dist/esm/chunk-7Q2NVO5M.mjs.map +1 -0
- package/dist/esm/{chunk-NPFNYP75.mjs → chunk-7STYQ5ZE.mjs} +2 -2
- package/dist/esm/{chunk-PZGLV5UQ.mjs → chunk-7WJTKYRG.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-C3L4ETUF.mjs} +2 -2
- package/dist/esm/chunk-C5UVSNZW.mjs +2 -0
- package/dist/esm/chunk-C5UVSNZW.mjs.map +1 -0
- package/dist/esm/{chunk-CTIN3GTP.mjs → chunk-CLVAGDXO.mjs} +2 -2
- package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-COW5IGYC.mjs} +2 -2
- package/dist/esm/chunk-D22EMNIY.mjs +2 -0
- package/dist/esm/{chunk-QMURTXFM.mjs.map → chunk-D22EMNIY.mjs.map} +1 -1
- package/dist/esm/{chunk-6CFRW26C.mjs → chunk-DLTC6PJP.mjs} +2 -2
- package/dist/esm/chunk-DLTC6PJP.mjs.map +1 -0
- package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-EB7AI4B4.mjs} +2 -2
- package/dist/esm/{chunk-YU3KB3UV.mjs → chunk-EKABTHUZ.mjs} +2 -2
- package/dist/esm/chunk-EOMDZYSJ.mjs +2 -0
- package/dist/esm/chunk-EOMDZYSJ.mjs.map +1 -0
- package/dist/esm/{chunk-SG4MAOCF.mjs → chunk-FKSACFCB.mjs} +2 -2
- package/dist/esm/chunk-FLYEALDB.mjs +2 -0
- package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
- package/dist/esm/{chunk-WLF5YQM4.mjs → chunk-G4XSNSOT.mjs} +2 -2
- package/dist/esm/chunk-G4XSNSOT.mjs.map +1 -0
- package/dist/esm/{chunk-MACC2BLE.mjs → chunk-H3TFQ7K4.mjs} +2 -2
- package/dist/esm/chunk-H6LYW7HG.mjs +2 -0
- package/dist/esm/chunk-H6LYW7HG.mjs.map +1 -0
- package/dist/esm/chunk-HCGWCB5E.mjs +2 -0
- package/dist/esm/chunk-HCGWCB5E.mjs.map +1 -0
- package/dist/esm/{chunk-UML2VQZT.mjs → chunk-HGZGTBA4.mjs} +2 -2
- package/dist/esm/{chunk-XO3HHRJV.mjs → chunk-HXSW6X7K.mjs} +2 -2
- package/dist/esm/chunk-IXYXFDJZ.mjs +2 -0
- package/dist/esm/{chunk-UFT7US42.mjs → chunk-J7J7ZTBF.mjs} +2 -2
- package/dist/esm/chunk-JVKMQ64G.mjs +2 -0
- package/dist/esm/chunk-JVKMQ64G.mjs.map +1 -0
- package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
- package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
- package/dist/esm/chunk-KWNBC5MF.mjs +2 -0
- package/dist/esm/chunk-KWNBC5MF.mjs.map +1 -0
- package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
- package/dist/esm/chunk-LDQ6JFEF.mjs.map +1 -0
- package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-MGOHPDX4.mjs} +2 -2
- package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MWUJCP27.mjs} +2 -2
- package/dist/esm/{chunk-QTRYMRYK.mjs → chunk-NC5HHEEM.mjs} +2 -2
- package/dist/esm/chunk-NGNETNK2.mjs +2 -0
- package/dist/esm/chunk-NGNETNK2.mjs.map +1 -0
- package/dist/esm/chunk-NKCZ4KGO.mjs +2 -0
- package/dist/esm/chunk-NKCZ4KGO.mjs.map +1 -0
- package/dist/esm/chunk-NMECYE3D.mjs +2 -0
- package/dist/esm/chunk-NMECYE3D.mjs.map +1 -0
- package/dist/esm/{chunk-AU6W5OIH.mjs → chunk-NNIHTVLA.mjs} +2 -2
- package/dist/esm/chunk-NNW6HWIO.mjs +2 -0
- package/dist/esm/{chunk-G2O323HP.mjs → chunk-O34EOOVF.mjs} +2 -2
- package/dist/esm/chunk-OBEVVLF7.mjs +2 -0
- package/dist/esm/chunk-OBEVVLF7.mjs.map +1 -0
- package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
- package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
- package/dist/esm/{chunk-PFIMEXNN.mjs → chunk-OLGSIKFB.mjs} +2 -2
- package/dist/esm/chunk-OLGSIKFB.mjs.map +1 -0
- package/dist/esm/chunk-OZC3FCJP.mjs +2 -0
- package/dist/esm/chunk-OZC3FCJP.mjs.map +1 -0
- package/dist/esm/{chunk-U43IJHQN.mjs → chunk-PFFAQZHT.mjs} +2 -2
- package/dist/esm/{chunk-ZZZZVONX.mjs → chunk-PINF6ZWP.mjs} +2 -2
- package/dist/esm/chunk-PJXRQBF6.mjs +2 -0
- package/dist/esm/chunk-PJXRQBF6.mjs.map +1 -0
- package/dist/esm/{chunk-7QJ6YJXP.mjs → chunk-QHVZL3LZ.mjs} +2 -2
- package/dist/esm/{chunk-DPV25ZKR.mjs → chunk-QNHDS64I.mjs} +2 -2
- package/dist/esm/{chunk-O2F53NKI.mjs → chunk-RBPGL6YB.mjs} +2 -2
- package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
- package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
- package/dist/esm/{chunk-DM44OGQH.mjs → chunk-RJ4PSGZ4.mjs} +2 -2
- package/dist/esm/{chunk-B3R6G6QP.mjs → chunk-RTSEMQCK.mjs} +2 -2
- package/dist/esm/chunk-RTSEMQCK.mjs.map +1 -0
- package/dist/esm/{chunk-V3Q2KXJU.mjs → chunk-SRPTQ4VV.mjs} +2 -2
- package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-STYDBDYL.mjs} +2 -2
- package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-T23OVRNF.mjs} +2 -2
- package/dist/esm/{chunk-RIUZPGI5.mjs → chunk-TICM455H.mjs} +2 -2
- package/dist/esm/{chunk-52C73T26.mjs → chunk-TVRJ3M7B.mjs} +2 -2
- package/dist/esm/{chunk-52C73T26.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
- package/dist/esm/{chunk-3WUGR46O.mjs → chunk-TXMPXZBG.mjs} +2 -2
- package/dist/esm/{chunk-W4ZW7QHA.mjs → chunk-UGIJHLL3.mjs} +2 -2
- package/dist/esm/{chunk-O4JRPZZM.mjs → chunk-UVOU6BW2.mjs} +2 -2
- package/dist/esm/{chunk-GSD4OOM3.mjs → chunk-V7P6MLSY.mjs} +2 -2
- package/dist/esm/{chunk-V6OS74OS.mjs → chunk-VJJN3GFD.mjs} +2 -2
- package/dist/esm/chunk-WOLIXKOK.mjs +2 -0
- package/dist/esm/chunk-WOLIXKOK.mjs.map +1 -0
- package/dist/esm/{chunk-Z5YFM2AW.mjs → chunk-WVIPPU2C.mjs} +2 -2
- package/dist/esm/chunk-WVIPPU2C.mjs.map +1 -0
- package/dist/esm/chunk-XCR3YNHW.mjs +2 -0
- package/dist/esm/chunk-XCR3YNHW.mjs.map +1 -0
- package/dist/esm/{chunk-5P2S2SZZ.mjs → chunk-XMFPKHB5.mjs} +2 -2
- package/dist/esm/chunk-XN4SQWI5.mjs +2 -0
- package/dist/esm/chunk-XN4SQWI5.mjs.map +1 -0
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/chunk-Z5KKUXYI.mjs +2 -0
- package/dist/esm/chunk-Z5KKUXYI.mjs.map +1 -0
- package/dist/esm/chunk-ZM436N3W.mjs +2 -0
- package/dist/esm/chunk-ZM436N3W.mjs.map +1 -0
- package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-ZNEBMSNC.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +12 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +105 -0
- package/dist/esm/cli/move.mjs +2 -0
- package/dist/esm/cli/move.mjs.map +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +2 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +3 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +5 -14
- 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.d.mts +0 -10
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/hdKey.d.mts +15 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +6 -4
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +217 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +7 -0
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +7 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.d.mts +5 -6
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +15 -9
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +13 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +7 -7
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +5 -5
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +67 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +7 -7
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +3 -4
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -2
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +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.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +72 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -28
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +6 -6
- package/dist/esm/types/index.d.mts +17 -3
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +16 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -2
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +7 -2
- package/src/{core/account → account}/Account.ts +25 -15
- package/src/{core/account → account}/Ed25519Account.ts +45 -9
- package/src/account/EphemeralKeyPair.ts +123 -0
- package/src/account/KeylessAccount.ts +303 -0
- package/src/account/MultiKeyAccount.ts +182 -0
- package/src/{core/account → account}/SingleKeyAccount.ts +45 -10
- package/src/account/index.ts +6 -0
- package/src/api/account.ts +2 -1
- package/src/api/ans.ts +2 -1
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/digitalAsset.ts +2 -1
- package/src/api/fungibleAsset.ts +2 -1
- package/src/api/keyless.ts +35 -0
- package/src/api/transaction.ts +2 -1
- package/src/api/transactionSubmission/management.ts +1 -1
- package/src/api/transactionSubmission/sign.ts +1 -1
- package/src/bcs/serializer.ts +18 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/move.ts +183 -0
- package/src/client/core.ts +8 -0
- package/src/client/get.ts +6 -0
- package/src/client/post.ts +12 -0
- package/src/core/account/index.ts +1 -3
- package/src/core/crypto/ed25519.ts +4 -24
- package/src/core/crypto/ephemeral.ts +149 -0
- package/src/core/crypto/hdKey.ts +31 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +508 -0
- package/src/core/crypto/multiKey.ts +17 -6
- package/src/core/crypto/poseidon.ts +134 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/core/index.ts +0 -1
- package/src/index.ts +1 -0
- package/src/internal/account.ts +1 -1
- package/src/internal/ans.ts +2 -2
- package/src/internal/digitalAsset.ts +2 -1
- package/src/internal/fungibleAsset.ts +3 -2
- package/src/internal/keyless.ts +118 -0
- package/src/internal/transactionSubmission.ts +8 -7
- package/src/transactions/authenticator/account.ts +6 -11
- package/src/transactions/management/accountSequenceNumber.ts +1 -1
- package/src/transactions/management/transactionWorker.ts +8 -2
- package/src/transactions/transactionBuilder/index.ts +1 -0
- package/src/transactions/transactionBuilder/signingMessage.ts +93 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -75
- package/src/types/index.ts +19 -0
- package/src/types/keyless.ts +6 -0
- package/src/utils/apiEndpoints.ts +14 -6
- package/src/utils/const.ts +2 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-24IKVZBK.mjs +0 -2
- package/dist/esm/chunk-24IKVZBK.mjs.map +0 -1
- package/dist/esm/chunk-2HISPUZZ.mjs +0 -2
- package/dist/esm/chunk-2HISPUZZ.mjs.map +0 -1
- package/dist/esm/chunk-6CFRW26C.mjs.map +0 -1
- package/dist/esm/chunk-734YX27W.mjs +0 -2
- package/dist/esm/chunk-AD3VLZ7I.mjs +0 -2
- package/dist/esm/chunk-AD3VLZ7I.mjs.map +0 -1
- package/dist/esm/chunk-B3R6G6QP.mjs.map +0 -1
- package/dist/esm/chunk-B7TQGVGL.mjs +0 -2
- package/dist/esm/chunk-CNMQNPNV.mjs +0 -2
- package/dist/esm/chunk-CNMQNPNV.mjs.map +0 -1
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
- package/dist/esm/chunk-EOFJFE4T.mjs +0 -2
- package/dist/esm/chunk-EOFJFE4T.mjs.map +0 -1
- package/dist/esm/chunk-FATWMUXK.mjs +0 -2
- package/dist/esm/chunk-FATWMUXK.mjs.map +0 -1
- package/dist/esm/chunk-HQ5I4Q3H.mjs +0 -2
- package/dist/esm/chunk-HQ5I4Q3H.mjs.map +0 -1
- package/dist/esm/chunk-IIPYR7PF.mjs.map +0 -1
- package/dist/esm/chunk-IKYIJYBY.mjs.map +0 -1
- package/dist/esm/chunk-KVZ4XMZS.mjs +0 -2
- package/dist/esm/chunk-KVZ4XMZS.mjs.map +0 -1
- package/dist/esm/chunk-LR65XHSF.mjs +0 -2
- package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
- package/dist/esm/chunk-MC6G725U.mjs +0 -2
- package/dist/esm/chunk-MC6G725U.mjs.map +0 -1
- package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
- package/dist/esm/chunk-NNQJBFRB.mjs +0 -2
- package/dist/esm/chunk-ODRO4CSA.mjs +0 -2
- package/dist/esm/chunk-ODRO4CSA.mjs.map +0 -1
- package/dist/esm/chunk-OVJQWQ2N.mjs +0 -2
- package/dist/esm/chunk-OVJQWQ2N.mjs.map +0 -1
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-PFIMEXNN.mjs.map +0 -1
- package/dist/esm/chunk-Q3TZGQVC.mjs.map +0 -1
- package/dist/esm/chunk-QMURTXFM.mjs +0 -2
- package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
- package/dist/esm/chunk-SUAKPNKQ.mjs +0 -2
- package/dist/esm/chunk-SUAKPNKQ.mjs.map +0 -1
- package/dist/esm/chunk-TLOPIURC.mjs +0 -2
- package/dist/esm/chunk-TLOPIURC.mjs.map +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-V4SRNEV3.mjs +0 -2
- package/dist/esm/chunk-V4SRNEV3.mjs.map +0 -1
- package/dist/esm/chunk-VVIG4E7Q.mjs +0 -2
- package/dist/esm/chunk-WLF5YQM4.mjs.map +0 -1
- package/dist/esm/chunk-XDGQTMDV.mjs +0 -2
- package/dist/esm/chunk-XDGQTMDV.mjs.map +0 -1
- package/dist/esm/chunk-YFRXBEOC.mjs +0 -2
- package/dist/esm/chunk-YFRXBEOC.mjs.map +0 -1
- package/dist/esm/chunk-YPTF6MLX.mjs +0 -2
- package/dist/esm/chunk-YPTF6MLX.mjs.map +0 -1
- package/dist/esm/chunk-Z5YFM2AW.mjs.map +0 -1
- package/dist/esm/core/account/Account.d.mts +0 -20
- package/dist/esm/core/account/Account.mjs +0 -2
- package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
- package/dist/esm/core/account/Ed25519Account.mjs +0 -2
- package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
- package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
- /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
- /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
- /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
- /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/index.mjs.map} +0 -0
- /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-3FVRXELT.mjs.map} +0 -0
- /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-3VGX3TXH.mjs.map} +0 -0
- /package/dist/esm/{chunk-CU67XZNB.mjs.map → chunk-52ECIIIH.mjs.map} +0 -0
- /package/dist/esm/{chunk-MFKMAAWA.mjs.map → chunk-6LOTZ4GY.mjs.map} +0 -0
- /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-6RBUXB5I.mjs.map} +0 -0
- /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-7STYQ5ZE.mjs.map} +0 -0
- /package/dist/esm/{chunk-PZGLV5UQ.mjs.map → chunk-7WJTKYRG.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-C3L4ETUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-CTIN3GTP.mjs.map → chunk-CLVAGDXO.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-COW5IGYC.mjs.map} +0 -0
- /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-EB7AI4B4.mjs.map} +0 -0
- /package/dist/esm/{chunk-YU3KB3UV.mjs.map → chunk-EKABTHUZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-SG4MAOCF.mjs.map → chunk-FKSACFCB.mjs.map} +0 -0
- /package/dist/esm/{chunk-MACC2BLE.mjs.map → chunk-H3TFQ7K4.mjs.map} +0 -0
- /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-HGZGTBA4.mjs.map} +0 -0
- /package/dist/esm/{chunk-XO3HHRJV.mjs.map → chunk-HXSW6X7K.mjs.map} +0 -0
- /package/dist/esm/{chunk-VVIG4E7Q.mjs.map → chunk-IXYXFDJZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UFT7US42.mjs.map → chunk-J7J7ZTBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-MGOHPDX4.mjs.map} +0 -0
- /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MWUJCP27.mjs.map} +0 -0
- /package/dist/esm/{chunk-QTRYMRYK.mjs.map → chunk-NC5HHEEM.mjs.map} +0 -0
- /package/dist/esm/{chunk-AU6W5OIH.mjs.map → chunk-NNIHTVLA.mjs.map} +0 -0
- /package/dist/esm/{chunk-NNQJBFRB.mjs.map → chunk-NNW6HWIO.mjs.map} +0 -0
- /package/dist/esm/{chunk-G2O323HP.mjs.map → chunk-O34EOOVF.mjs.map} +0 -0
- /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-PFFAQZHT.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZZZZVONX.mjs.map → chunk-PINF6ZWP.mjs.map} +0 -0
- /package/dist/esm/{chunk-7QJ6YJXP.mjs.map → chunk-QHVZL3LZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPV25ZKR.mjs.map → chunk-QNHDS64I.mjs.map} +0 -0
- /package/dist/esm/{chunk-O2F53NKI.mjs.map → chunk-RBPGL6YB.mjs.map} +0 -0
- /package/dist/esm/{chunk-DM44OGQH.mjs.map → chunk-RJ4PSGZ4.mjs.map} +0 -0
- /package/dist/esm/{chunk-V3Q2KXJU.mjs.map → chunk-SRPTQ4VV.mjs.map} +0 -0
- /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-STYDBDYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-T23OVRNF.mjs.map} +0 -0
- /package/dist/esm/{chunk-RIUZPGI5.mjs.map → chunk-TICM455H.mjs.map} +0 -0
- /package/dist/esm/{chunk-3WUGR46O.mjs.map → chunk-TXMPXZBG.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4ZW7QHA.mjs.map → chunk-UGIJHLL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4JRPZZM.mjs.map → chunk-UVOU6BW2.mjs.map} +0 -0
- /package/dist/esm/{chunk-GSD4OOM3.mjs.map → chunk-V7P6MLSY.mjs.map} +0 -0
- /package/dist/esm/{chunk-V6OS74OS.mjs.map → chunk-VJJN3GFD.mjs.map} +0 -0
- /package/dist/esm/{chunk-5P2S2SZZ.mjs.map → chunk-XMFPKHB5.mjs.map} +0 -0
- /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-ZNEBMSNC.mjs.map} +0 -0
|
@@ -0,0 +1,2121 @@
|
|
|
1
|
+
declare const NetworkToIndexerAPI: Record<string, string>;
|
|
2
|
+
declare const NetworkToNodeAPI: Record<string, string>;
|
|
3
|
+
declare const NetworkToFaucetAPI: Record<string, string>;
|
|
4
|
+
declare const NetworkToPepperAPI: Record<string, string>;
|
|
5
|
+
declare const NetworkToProverAPI: Record<string, string>;
|
|
6
|
+
declare enum Network {
|
|
7
|
+
MAINNET = "mainnet",
|
|
8
|
+
TESTNET = "testnet",
|
|
9
|
+
DEVNET = "devnet",
|
|
10
|
+
LOCAL = "local",
|
|
11
|
+
CUSTOM = "custom"
|
|
12
|
+
}
|
|
13
|
+
declare const NetworkToChainId: Record<string, number>;
|
|
14
|
+
declare const NetworkToNetworkName: Record<string, Network>;
|
|
15
|
+
|
|
16
|
+
type GetAccountCoinsDataQuery = {
|
|
17
|
+
current_fungible_asset_balances: Array<{
|
|
18
|
+
amount: any;
|
|
19
|
+
asset_type: string;
|
|
20
|
+
is_frozen: boolean;
|
|
21
|
+
is_primary: boolean;
|
|
22
|
+
last_transaction_timestamp: any;
|
|
23
|
+
last_transaction_version: any;
|
|
24
|
+
owner_address: string;
|
|
25
|
+
storage_id: string;
|
|
26
|
+
token_standard: string;
|
|
27
|
+
metadata?: {
|
|
28
|
+
token_standard: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
supply_aggregator_table_key_v1?: string | null;
|
|
31
|
+
supply_aggregator_table_handle_v1?: string | null;
|
|
32
|
+
project_uri?: string | null;
|
|
33
|
+
name: string;
|
|
34
|
+
last_transaction_version: any;
|
|
35
|
+
last_transaction_timestamp: any;
|
|
36
|
+
icon_uri?: string | null;
|
|
37
|
+
decimals: number;
|
|
38
|
+
creator_address: string;
|
|
39
|
+
asset_type: string;
|
|
40
|
+
} | null;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
type GetAccountCollectionsWithOwnedTokensQuery = {
|
|
44
|
+
current_collection_ownership_v2_view: Array<{
|
|
45
|
+
collection_id?: string | null;
|
|
46
|
+
collection_name?: string | null;
|
|
47
|
+
collection_uri?: string | null;
|
|
48
|
+
creator_address?: string | null;
|
|
49
|
+
distinct_tokens?: any | null;
|
|
50
|
+
last_transaction_version?: any | null;
|
|
51
|
+
owner_address?: string | null;
|
|
52
|
+
single_token_uri?: string | null;
|
|
53
|
+
current_collection?: {
|
|
54
|
+
collection_id: string;
|
|
55
|
+
collection_name: string;
|
|
56
|
+
creator_address: string;
|
|
57
|
+
current_supply: any;
|
|
58
|
+
description: string;
|
|
59
|
+
last_transaction_timestamp: any;
|
|
60
|
+
last_transaction_version: any;
|
|
61
|
+
mutable_description?: boolean | null;
|
|
62
|
+
max_supply?: any | null;
|
|
63
|
+
mutable_uri?: boolean | null;
|
|
64
|
+
table_handle_v1?: string | null;
|
|
65
|
+
token_standard: string;
|
|
66
|
+
total_minted_v2?: any | null;
|
|
67
|
+
uri: string;
|
|
68
|
+
} | null;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
type GetAccountOwnedObjectsQuery = {
|
|
72
|
+
current_objects: Array<{
|
|
73
|
+
allow_ungated_transfer: boolean;
|
|
74
|
+
state_key_hash: string;
|
|
75
|
+
owner_address: string;
|
|
76
|
+
object_address: string;
|
|
77
|
+
last_transaction_version: any;
|
|
78
|
+
last_guid_creation_num: any;
|
|
79
|
+
is_deleted: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
};
|
|
82
|
+
type GetAccountOwnedTokensQuery = {
|
|
83
|
+
current_token_ownerships_v2: Array<{
|
|
84
|
+
token_standard: string;
|
|
85
|
+
token_properties_mutated_v1?: any | null;
|
|
86
|
+
token_data_id: string;
|
|
87
|
+
table_type_v1?: string | null;
|
|
88
|
+
storage_id: string;
|
|
89
|
+
property_version_v1: any;
|
|
90
|
+
owner_address: string;
|
|
91
|
+
last_transaction_version: any;
|
|
92
|
+
last_transaction_timestamp: any;
|
|
93
|
+
is_soulbound_v2?: boolean | null;
|
|
94
|
+
is_fungible_v2?: boolean | null;
|
|
95
|
+
amount: any;
|
|
96
|
+
current_token_data?: {
|
|
97
|
+
collection_id: string;
|
|
98
|
+
description: string;
|
|
99
|
+
is_fungible_v2?: boolean | null;
|
|
100
|
+
largest_property_version_v1?: any | null;
|
|
101
|
+
last_transaction_timestamp: any;
|
|
102
|
+
last_transaction_version: any;
|
|
103
|
+
maximum?: any | null;
|
|
104
|
+
supply: any;
|
|
105
|
+
token_data_id: string;
|
|
106
|
+
token_name: string;
|
|
107
|
+
token_properties: any;
|
|
108
|
+
token_standard: string;
|
|
109
|
+
token_uri: string;
|
|
110
|
+
decimals: any;
|
|
111
|
+
current_collection?: {
|
|
112
|
+
collection_id: string;
|
|
113
|
+
collection_name: string;
|
|
114
|
+
creator_address: string;
|
|
115
|
+
current_supply: any;
|
|
116
|
+
description: string;
|
|
117
|
+
last_transaction_timestamp: any;
|
|
118
|
+
last_transaction_version: any;
|
|
119
|
+
max_supply?: any | null;
|
|
120
|
+
mutable_description?: boolean | null;
|
|
121
|
+
mutable_uri?: boolean | null;
|
|
122
|
+
table_handle_v1?: string | null;
|
|
123
|
+
token_standard: string;
|
|
124
|
+
total_minted_v2?: any | null;
|
|
125
|
+
uri: string;
|
|
126
|
+
} | null;
|
|
127
|
+
} | null;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
type GetAccountOwnedTokensFromCollectionQuery = {
|
|
131
|
+
current_token_ownerships_v2: Array<{
|
|
132
|
+
token_standard: string;
|
|
133
|
+
token_properties_mutated_v1?: any | null;
|
|
134
|
+
token_data_id: string;
|
|
135
|
+
table_type_v1?: string | null;
|
|
136
|
+
storage_id: string;
|
|
137
|
+
property_version_v1: any;
|
|
138
|
+
owner_address: string;
|
|
139
|
+
last_transaction_version: any;
|
|
140
|
+
last_transaction_timestamp: any;
|
|
141
|
+
is_soulbound_v2?: boolean | null;
|
|
142
|
+
is_fungible_v2?: boolean | null;
|
|
143
|
+
amount: any;
|
|
144
|
+
current_token_data?: {
|
|
145
|
+
collection_id: string;
|
|
146
|
+
description: string;
|
|
147
|
+
is_fungible_v2?: boolean | null;
|
|
148
|
+
largest_property_version_v1?: any | null;
|
|
149
|
+
last_transaction_timestamp: any;
|
|
150
|
+
last_transaction_version: any;
|
|
151
|
+
maximum?: any | null;
|
|
152
|
+
supply: any;
|
|
153
|
+
token_data_id: string;
|
|
154
|
+
token_name: string;
|
|
155
|
+
token_properties: any;
|
|
156
|
+
token_standard: string;
|
|
157
|
+
token_uri: string;
|
|
158
|
+
decimals: any;
|
|
159
|
+
current_collection?: {
|
|
160
|
+
collection_id: string;
|
|
161
|
+
collection_name: string;
|
|
162
|
+
creator_address: string;
|
|
163
|
+
current_supply: any;
|
|
164
|
+
description: string;
|
|
165
|
+
last_transaction_timestamp: any;
|
|
166
|
+
last_transaction_version: any;
|
|
167
|
+
max_supply?: any | null;
|
|
168
|
+
mutable_description?: boolean | null;
|
|
169
|
+
mutable_uri?: boolean | null;
|
|
170
|
+
table_handle_v1?: string | null;
|
|
171
|
+
token_standard: string;
|
|
172
|
+
total_minted_v2?: any | null;
|
|
173
|
+
uri: string;
|
|
174
|
+
} | null;
|
|
175
|
+
} | null;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
type GetChainTopUserTransactionsQuery = {
|
|
179
|
+
user_transactions: Array<{
|
|
180
|
+
version: any;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
type GetCollectionDataQuery = {
|
|
184
|
+
current_collections_v2: Array<{
|
|
185
|
+
collection_id: string;
|
|
186
|
+
collection_name: string;
|
|
187
|
+
creator_address: string;
|
|
188
|
+
current_supply: any;
|
|
189
|
+
description: string;
|
|
190
|
+
last_transaction_timestamp: any;
|
|
191
|
+
last_transaction_version: any;
|
|
192
|
+
max_supply?: any | null;
|
|
193
|
+
mutable_description?: boolean | null;
|
|
194
|
+
mutable_uri?: boolean | null;
|
|
195
|
+
table_handle_v1?: string | null;
|
|
196
|
+
token_standard: string;
|
|
197
|
+
total_minted_v2?: any | null;
|
|
198
|
+
uri: string;
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
type GetCurrentFungibleAssetBalancesQuery = {
|
|
202
|
+
current_fungible_asset_balances: Array<{
|
|
203
|
+
amount: any;
|
|
204
|
+
asset_type: string;
|
|
205
|
+
is_frozen: boolean;
|
|
206
|
+
is_primary: boolean;
|
|
207
|
+
last_transaction_timestamp: any;
|
|
208
|
+
last_transaction_version: any;
|
|
209
|
+
owner_address: string;
|
|
210
|
+
storage_id: string;
|
|
211
|
+
token_standard: string;
|
|
212
|
+
}>;
|
|
213
|
+
};
|
|
214
|
+
type GetDelegatedStakingActivitiesQuery = {
|
|
215
|
+
delegated_staking_activities: Array<{
|
|
216
|
+
amount: any;
|
|
217
|
+
delegator_address: string;
|
|
218
|
+
event_index: any;
|
|
219
|
+
event_type: string;
|
|
220
|
+
pool_address: string;
|
|
221
|
+
transaction_version: any;
|
|
222
|
+
}>;
|
|
223
|
+
};
|
|
224
|
+
type GetEventsQuery = {
|
|
225
|
+
events: Array<{
|
|
226
|
+
account_address: string;
|
|
227
|
+
creation_number: any;
|
|
228
|
+
data: any;
|
|
229
|
+
event_index: any;
|
|
230
|
+
sequence_number: any;
|
|
231
|
+
transaction_block_height: any;
|
|
232
|
+
transaction_version: any;
|
|
233
|
+
type: string;
|
|
234
|
+
indexed_type: string;
|
|
235
|
+
}>;
|
|
236
|
+
};
|
|
237
|
+
type GetFungibleAssetActivitiesQuery = {
|
|
238
|
+
fungible_asset_activities: Array<{
|
|
239
|
+
amount?: any | null;
|
|
240
|
+
asset_type: string;
|
|
241
|
+
block_height: any;
|
|
242
|
+
entry_function_id_str?: string | null;
|
|
243
|
+
event_index: any;
|
|
244
|
+
gas_fee_payer_address?: string | null;
|
|
245
|
+
is_frozen?: boolean | null;
|
|
246
|
+
is_gas_fee: boolean;
|
|
247
|
+
is_transaction_success: boolean;
|
|
248
|
+
owner_address: string;
|
|
249
|
+
storage_id: string;
|
|
250
|
+
storage_refund_amount: any;
|
|
251
|
+
token_standard: string;
|
|
252
|
+
transaction_timestamp: any;
|
|
253
|
+
transaction_version: any;
|
|
254
|
+
type: string;
|
|
255
|
+
}>;
|
|
256
|
+
};
|
|
257
|
+
type GetFungibleAssetMetadataQuery = {
|
|
258
|
+
fungible_asset_metadata: Array<{
|
|
259
|
+
icon_uri?: string | null;
|
|
260
|
+
project_uri?: string | null;
|
|
261
|
+
supply_aggregator_table_handle_v1?: string | null;
|
|
262
|
+
supply_aggregator_table_key_v1?: string | null;
|
|
263
|
+
creator_address: string;
|
|
264
|
+
asset_type: string;
|
|
265
|
+
decimals: number;
|
|
266
|
+
last_transaction_timestamp: any;
|
|
267
|
+
last_transaction_version: any;
|
|
268
|
+
name: string;
|
|
269
|
+
symbol: string;
|
|
270
|
+
token_standard: string;
|
|
271
|
+
}>;
|
|
272
|
+
};
|
|
273
|
+
type GetNamesQuery = {
|
|
274
|
+
current_aptos_names: Array<{
|
|
275
|
+
domain?: string | null;
|
|
276
|
+
expiration_timestamp?: any | null;
|
|
277
|
+
registered_address?: string | null;
|
|
278
|
+
subdomain?: string | null;
|
|
279
|
+
token_standard?: string | null;
|
|
280
|
+
is_primary?: boolean | null;
|
|
281
|
+
owner_address?: string | null;
|
|
282
|
+
}>;
|
|
283
|
+
};
|
|
284
|
+
type GetNumberOfDelegatorsQuery = {
|
|
285
|
+
num_active_delegator_per_pool: Array<{
|
|
286
|
+
num_active_delegator?: any | null;
|
|
287
|
+
pool_address?: string | null;
|
|
288
|
+
}>;
|
|
289
|
+
};
|
|
290
|
+
type GetProcessorStatusQuery = {
|
|
291
|
+
processor_status: Array<{
|
|
292
|
+
last_success_version: any;
|
|
293
|
+
processor: string;
|
|
294
|
+
last_updated: any;
|
|
295
|
+
}>;
|
|
296
|
+
};
|
|
297
|
+
type GetTokenActivityQuery = {
|
|
298
|
+
token_activities_v2: Array<{
|
|
299
|
+
after_value?: string | null;
|
|
300
|
+
before_value?: string | null;
|
|
301
|
+
entry_function_id_str?: string | null;
|
|
302
|
+
event_account_address: string;
|
|
303
|
+
event_index: any;
|
|
304
|
+
from_address?: string | null;
|
|
305
|
+
is_fungible_v2?: boolean | null;
|
|
306
|
+
property_version_v1: any;
|
|
307
|
+
to_address?: string | null;
|
|
308
|
+
token_amount: any;
|
|
309
|
+
token_data_id: string;
|
|
310
|
+
token_standard: string;
|
|
311
|
+
transaction_timestamp: any;
|
|
312
|
+
transaction_version: any;
|
|
313
|
+
type: string;
|
|
314
|
+
}>;
|
|
315
|
+
};
|
|
316
|
+
type GetCurrentTokenOwnershipQuery = {
|
|
317
|
+
current_token_ownerships_v2: Array<{
|
|
318
|
+
token_standard: string;
|
|
319
|
+
token_properties_mutated_v1?: any | null;
|
|
320
|
+
token_data_id: string;
|
|
321
|
+
table_type_v1?: string | null;
|
|
322
|
+
storage_id: string;
|
|
323
|
+
property_version_v1: any;
|
|
324
|
+
owner_address: string;
|
|
325
|
+
last_transaction_version: any;
|
|
326
|
+
last_transaction_timestamp: any;
|
|
327
|
+
is_soulbound_v2?: boolean | null;
|
|
328
|
+
is_fungible_v2?: boolean | null;
|
|
329
|
+
amount: any;
|
|
330
|
+
current_token_data?: {
|
|
331
|
+
collection_id: string;
|
|
332
|
+
description: string;
|
|
333
|
+
is_fungible_v2?: boolean | null;
|
|
334
|
+
largest_property_version_v1?: any | null;
|
|
335
|
+
last_transaction_timestamp: any;
|
|
336
|
+
last_transaction_version: any;
|
|
337
|
+
maximum?: any | null;
|
|
338
|
+
supply: any;
|
|
339
|
+
token_data_id: string;
|
|
340
|
+
token_name: string;
|
|
341
|
+
token_properties: any;
|
|
342
|
+
token_standard: string;
|
|
343
|
+
token_uri: string;
|
|
344
|
+
decimals: any;
|
|
345
|
+
current_collection?: {
|
|
346
|
+
collection_id: string;
|
|
347
|
+
collection_name: string;
|
|
348
|
+
creator_address: string;
|
|
349
|
+
current_supply: any;
|
|
350
|
+
description: string;
|
|
351
|
+
last_transaction_timestamp: any;
|
|
352
|
+
last_transaction_version: any;
|
|
353
|
+
max_supply?: any | null;
|
|
354
|
+
mutable_description?: boolean | null;
|
|
355
|
+
mutable_uri?: boolean | null;
|
|
356
|
+
table_handle_v1?: string | null;
|
|
357
|
+
token_standard: string;
|
|
358
|
+
total_minted_v2?: any | null;
|
|
359
|
+
uri: string;
|
|
360
|
+
} | null;
|
|
361
|
+
} | null;
|
|
362
|
+
}>;
|
|
363
|
+
};
|
|
364
|
+
type GetTokenDataQuery = {
|
|
365
|
+
current_token_datas_v2: Array<{
|
|
366
|
+
collection_id: string;
|
|
367
|
+
description: string;
|
|
368
|
+
is_fungible_v2?: boolean | null;
|
|
369
|
+
largest_property_version_v1?: any | null;
|
|
370
|
+
last_transaction_timestamp: any;
|
|
371
|
+
last_transaction_version: any;
|
|
372
|
+
maximum?: any | null;
|
|
373
|
+
supply: any;
|
|
374
|
+
token_data_id: string;
|
|
375
|
+
token_name: string;
|
|
376
|
+
token_properties: any;
|
|
377
|
+
token_standard: string;
|
|
378
|
+
token_uri: string;
|
|
379
|
+
decimals: any;
|
|
380
|
+
current_collection?: {
|
|
381
|
+
collection_id: string;
|
|
382
|
+
collection_name: string;
|
|
383
|
+
creator_address: string;
|
|
384
|
+
current_supply: any;
|
|
385
|
+
description: string;
|
|
386
|
+
last_transaction_timestamp: any;
|
|
387
|
+
last_transaction_version: any;
|
|
388
|
+
max_supply?: any | null;
|
|
389
|
+
mutable_description?: boolean | null;
|
|
390
|
+
mutable_uri?: boolean | null;
|
|
391
|
+
table_handle_v1?: string | null;
|
|
392
|
+
token_standard: string;
|
|
393
|
+
total_minted_v2?: any | null;
|
|
394
|
+
uri: string;
|
|
395
|
+
} | null;
|
|
396
|
+
}>;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* GENERATED QUERY TYPES FROM GRAPHQL SCHEMA
|
|
401
|
+
*
|
|
402
|
+
* generated types we generate from graphql schema that match the structure of the
|
|
403
|
+
* response type when querying from Hasura schema.
|
|
404
|
+
*
|
|
405
|
+
* These types are used as the return type when making the actual request (usually
|
|
406
|
+
* under the /internal/ folder)
|
|
407
|
+
*/
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* CUSTOM RESPONSE TYPES FOR THE END USER
|
|
411
|
+
*
|
|
412
|
+
* To provide a good dev exp, we build custom types derived from the
|
|
413
|
+
* query types to be the response type the end developer/user will
|
|
414
|
+
* work with.
|
|
415
|
+
*
|
|
416
|
+
* These types are used as the return type when calling a sdk api function
|
|
417
|
+
* that calls the function that queries the server (usually under the /api/ folder)
|
|
418
|
+
*/
|
|
419
|
+
type GetAccountOwnedObjectsResponse = GetAccountOwnedObjectsQuery["current_objects"];
|
|
420
|
+
type GetAccountOwnedTokensQueryResponse = GetAccountOwnedTokensQuery["current_token_ownerships_v2"];
|
|
421
|
+
type GetAccountOwnedTokensFromCollectionResponse = GetAccountOwnedTokensFromCollectionQuery["current_token_ownerships_v2"];
|
|
422
|
+
type GetAccountCollectionsWithOwnedTokenResponse = GetAccountCollectionsWithOwnedTokensQuery["current_collection_ownership_v2_view"];
|
|
423
|
+
type GetAccountCoinsDataResponse = GetAccountCoinsDataQuery["current_fungible_asset_balances"];
|
|
424
|
+
type GetChainTopUserTransactionsResponse = GetChainTopUserTransactionsQuery["user_transactions"];
|
|
425
|
+
type GetEventsResponse = GetEventsQuery["events"];
|
|
426
|
+
type GetNumberOfDelegatorsResponse = GetNumberOfDelegatorsQuery["num_active_delegator_per_pool"];
|
|
427
|
+
type GetDelegatedStakingActivitiesResponse = GetDelegatedStakingActivitiesQuery["delegated_staking_activities"];
|
|
428
|
+
type GetCollectionDataResponse = GetCollectionDataQuery["current_collections_v2"][0];
|
|
429
|
+
type GetTokenDataResponse = GetTokenDataQuery["current_token_datas_v2"][0];
|
|
430
|
+
type GetProcessorStatusResponse = GetProcessorStatusQuery["processor_status"];
|
|
431
|
+
type GetFungibleAssetMetadataResponse = GetFungibleAssetMetadataQuery["fungible_asset_metadata"];
|
|
432
|
+
type GetFungibleAssetActivitiesResponse = GetFungibleAssetActivitiesQuery["fungible_asset_activities"];
|
|
433
|
+
type GetCurrentFungibleAssetBalancesResponse = GetCurrentFungibleAssetBalancesQuery["current_fungible_asset_balances"];
|
|
434
|
+
type GetTokenActivityResponse = GetTokenActivityQuery["token_activities_v2"];
|
|
435
|
+
type GetCurrentTokenOwnershipResponse = GetCurrentTokenOwnershipQuery["current_token_ownerships_v2"][0];
|
|
436
|
+
type GetOwnedTokensResponse = GetCurrentTokenOwnershipQuery["current_token_ownerships_v2"];
|
|
437
|
+
type GetANSNameResponse = GetNamesQuery["current_aptos_names"];
|
|
438
|
+
/**
|
|
439
|
+
* A generic type that being passed by each function and holds an
|
|
440
|
+
* array of properties we can sort the query by
|
|
441
|
+
*/
|
|
442
|
+
type OrderBy<T> = Array<{
|
|
443
|
+
[K in keyof T]?: OrderByValue;
|
|
444
|
+
}>;
|
|
445
|
+
type OrderByValue = "asc" | "asc_nulls_first" | "asc_nulls_last" | "desc" | "desc_nulls_first" | "desc_nulls_last";
|
|
446
|
+
/**
|
|
447
|
+
* Refers to the token standard we want to query for
|
|
448
|
+
*/
|
|
449
|
+
type TokenStandard = "v1" | "v2";
|
|
450
|
+
/**
|
|
451
|
+
* The graphql query type to pass into the `queryIndexer` function
|
|
452
|
+
*/
|
|
453
|
+
type GraphqlQuery = {
|
|
454
|
+
query: string;
|
|
455
|
+
variables?: {};
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
declare enum MimeType {
|
|
459
|
+
/**
|
|
460
|
+
* JSON representation, used for transaction submission and accept type JSON output
|
|
461
|
+
*/
|
|
462
|
+
JSON = "application/json",
|
|
463
|
+
/**
|
|
464
|
+
* BCS representation, used for accept type BCS output
|
|
465
|
+
*/
|
|
466
|
+
BCS = "application/x-bcs",
|
|
467
|
+
/**
|
|
468
|
+
* BCS representation, used for transaction submission in BCS input
|
|
469
|
+
*/
|
|
470
|
+
BCS_SIGNED_TRANSACTION = "application/x.aptos.signed_transaction+bcs",
|
|
471
|
+
BCS_VIEW_FUNCTION = "application/x.aptos.view_function+bcs"
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Hex data as input to a function
|
|
475
|
+
*/
|
|
476
|
+
type HexInput = string | Uint8Array;
|
|
477
|
+
/**
|
|
478
|
+
* TypeTag enum as they are represented in Rust
|
|
479
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}
|
|
480
|
+
*/
|
|
481
|
+
declare enum TypeTagVariants {
|
|
482
|
+
Bool = 0,
|
|
483
|
+
U8 = 1,
|
|
484
|
+
U64 = 2,
|
|
485
|
+
U128 = 3,
|
|
486
|
+
Address = 4,
|
|
487
|
+
Signer = 5,
|
|
488
|
+
Vector = 6,
|
|
489
|
+
Struct = 7,
|
|
490
|
+
U16 = 8,
|
|
491
|
+
U32 = 9,
|
|
492
|
+
U256 = 10,
|
|
493
|
+
Reference = 254,// This is specifically a placeholder and does not represent a real type
|
|
494
|
+
Generic = 255
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Script transaction arguments enum as they are represented in Rust
|
|
498
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}
|
|
499
|
+
*/
|
|
500
|
+
declare enum ScriptTransactionArgumentVariants {
|
|
501
|
+
U8 = 0,
|
|
502
|
+
U64 = 1,
|
|
503
|
+
U128 = 2,
|
|
504
|
+
Address = 3,
|
|
505
|
+
U8Vector = 4,
|
|
506
|
+
Bool = 5,
|
|
507
|
+
U16 = 6,
|
|
508
|
+
U32 = 7,
|
|
509
|
+
U256 = 8
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Transaction payload enum as they are represented in Rust
|
|
513
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}
|
|
514
|
+
*/
|
|
515
|
+
declare enum TransactionPayloadVariants {
|
|
516
|
+
Script = 0,
|
|
517
|
+
EntryFunction = 2,
|
|
518
|
+
Multisig = 3
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Transaction variants enum as they are represented in Rust
|
|
522
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}
|
|
523
|
+
*/
|
|
524
|
+
declare enum TransactionVariants {
|
|
525
|
+
MultiAgentTransaction = 0,
|
|
526
|
+
FeePayerTransaction = 1
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Transaction Authenticator enum as they are represented in Rust
|
|
530
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}
|
|
531
|
+
*/
|
|
532
|
+
declare enum TransactionAuthenticatorVariant {
|
|
533
|
+
Ed25519 = 0,
|
|
534
|
+
MultiEd25519 = 1,
|
|
535
|
+
MultiAgent = 2,
|
|
536
|
+
FeePayer = 3,
|
|
537
|
+
SingleSender = 4
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Transaction Authenticator enum as they are represented in Rust
|
|
541
|
+
* {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}
|
|
542
|
+
*/
|
|
543
|
+
declare enum AccountAuthenticatorVariant {
|
|
544
|
+
Ed25519 = 0,
|
|
545
|
+
MultiEd25519 = 1,
|
|
546
|
+
SingleKey = 2,
|
|
547
|
+
MultiKey = 3
|
|
548
|
+
}
|
|
549
|
+
declare enum AnyPublicKeyVariant {
|
|
550
|
+
Ed25519 = 0,
|
|
551
|
+
Secp256k1 = 1,
|
|
552
|
+
Keyless = 3
|
|
553
|
+
}
|
|
554
|
+
declare enum AnySignatureVariant {
|
|
555
|
+
Ed25519 = 0,
|
|
556
|
+
Secp256k1 = 1,
|
|
557
|
+
Keyless = 3
|
|
558
|
+
}
|
|
559
|
+
declare enum EphemeralPublicKeyVariant {
|
|
560
|
+
Ed25519 = 0
|
|
561
|
+
}
|
|
562
|
+
declare enum EphemeralSignatureVariant {
|
|
563
|
+
Ed25519 = 0
|
|
564
|
+
}
|
|
565
|
+
declare enum EphemeralCertificate {
|
|
566
|
+
ZkProof = 0,
|
|
567
|
+
OpenIdSignature = 1
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* BCS types
|
|
571
|
+
*/
|
|
572
|
+
type Uint8 = number;
|
|
573
|
+
type Uint16 = number;
|
|
574
|
+
type Uint32 = number;
|
|
575
|
+
type Uint64 = bigint;
|
|
576
|
+
type Uint128 = bigint;
|
|
577
|
+
type Uint256 = bigint;
|
|
578
|
+
type AnyNumber = number | bigint;
|
|
579
|
+
/**
|
|
580
|
+
* Set of configuration options that can be provided when initializing the SDK.
|
|
581
|
+
* The purpose of these options is to configure various aspects of the SDK's
|
|
582
|
+
* behavior and interaction with the Aptos network
|
|
583
|
+
*/
|
|
584
|
+
type AptosSettings = {
|
|
585
|
+
readonly network?: Network;
|
|
586
|
+
readonly fullnode?: string;
|
|
587
|
+
readonly faucet?: string;
|
|
588
|
+
readonly indexer?: string;
|
|
589
|
+
readonly pepper?: string;
|
|
590
|
+
readonly prover?: string;
|
|
591
|
+
readonly clientConfig?: ClientConfig;
|
|
592
|
+
readonly client?: Client;
|
|
593
|
+
readonly fullnodeConfig?: FullNodeConfig;
|
|
594
|
+
readonly indexerConfig?: IndexerConfig;
|
|
595
|
+
readonly faucetConfig?: FaucetConfig;
|
|
596
|
+
};
|
|
597
|
+
/**
|
|
598
|
+
*
|
|
599
|
+
* Controls the number of results that are returned and the starting position of those results.
|
|
600
|
+
* @param offset parameter specifies the starting position of the query result within the set of data. Default is 0.
|
|
601
|
+
* @param limit specifies the maximum number of items or records to return in a query result. Default is 25.
|
|
602
|
+
*/
|
|
603
|
+
interface PaginationArgs {
|
|
604
|
+
offset?: AnyNumber;
|
|
605
|
+
limit?: number;
|
|
606
|
+
}
|
|
607
|
+
interface TokenStandardArg {
|
|
608
|
+
tokenStandard?: TokenStandard;
|
|
609
|
+
}
|
|
610
|
+
interface OrderByArg<T extends {}> {
|
|
611
|
+
orderBy?: OrderBy<T>;
|
|
612
|
+
}
|
|
613
|
+
interface WhereArg<T extends {}> {
|
|
614
|
+
where?: T;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* QUERY TYPES
|
|
618
|
+
*/
|
|
619
|
+
/**
|
|
620
|
+
* A configuration object we can pass with the request to the server.
|
|
621
|
+
*
|
|
622
|
+
* @param API_KEY - api key generated from developer portal {@link https://developers.aptoslabs.com/manage/api-keys}}
|
|
623
|
+
* @param HEADERS - extra headers we want to send with the request
|
|
624
|
+
* @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent
|
|
625
|
+
*/
|
|
626
|
+
type ClientConfig = ClientHeadersType & {
|
|
627
|
+
WITH_CREDENTIALS?: boolean;
|
|
628
|
+
API_KEY?: string;
|
|
629
|
+
};
|
|
630
|
+
/**
|
|
631
|
+
* A Fullnode only configuration object
|
|
632
|
+
*
|
|
633
|
+
* @param HEADERS - extra headers we want to send with the request
|
|
634
|
+
*/
|
|
635
|
+
type FullNodeConfig = ClientHeadersType;
|
|
636
|
+
/**
|
|
637
|
+
* An Indexer only configuration object
|
|
638
|
+
*
|
|
639
|
+
* @param HEADERS - extra headers we want to send with the request
|
|
640
|
+
*/
|
|
641
|
+
type IndexerConfig = ClientHeadersType;
|
|
642
|
+
/**
|
|
643
|
+
* A Faucet only configuration object
|
|
644
|
+
*
|
|
645
|
+
* @param HEADERS - extra headers we want to send with the request
|
|
646
|
+
* @param AUTH_TOKEN - an auth token to send with a faucet request
|
|
647
|
+
*/
|
|
648
|
+
type FaucetConfig = ClientHeadersType & {
|
|
649
|
+
AUTH_TOKEN?: string;
|
|
650
|
+
};
|
|
651
|
+
/**
|
|
652
|
+
* General type definition for client HEADERS
|
|
653
|
+
*/
|
|
654
|
+
type ClientHeadersType = {
|
|
655
|
+
HEADERS?: Record<string, string | number | boolean>;
|
|
656
|
+
};
|
|
657
|
+
interface ClientRequest<Req> {
|
|
658
|
+
url: string;
|
|
659
|
+
method: "GET" | "POST";
|
|
660
|
+
originMethod?: string;
|
|
661
|
+
body?: Req;
|
|
662
|
+
contentType?: string;
|
|
663
|
+
params?: any;
|
|
664
|
+
overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;
|
|
665
|
+
headers?: Record<string, any>;
|
|
666
|
+
}
|
|
667
|
+
interface ClientResponse<Res> {
|
|
668
|
+
status: number;
|
|
669
|
+
statusText: string;
|
|
670
|
+
data: Res;
|
|
671
|
+
config?: any;
|
|
672
|
+
request?: any;
|
|
673
|
+
response?: any;
|
|
674
|
+
headers?: any;
|
|
675
|
+
}
|
|
676
|
+
interface Client {
|
|
677
|
+
provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* The API request type
|
|
681
|
+
*
|
|
682
|
+
* @param url - the url to make the request to, i.e https://fullnode.devnet.aptoslabs.com/v1
|
|
683
|
+
* @param method - the request method "GET" | "POST"
|
|
684
|
+
* @param endpoint (optional) - the endpoint to make the request to, i.e transactions
|
|
685
|
+
* @param body (optional) - the body of the request
|
|
686
|
+
* @param contentType (optional) - the content type to set the `content-type` header to,
|
|
687
|
+
* by default is set to `application/json`
|
|
688
|
+
* @param params (optional) - query params to add to the request
|
|
689
|
+
* @param originMethod (optional) - the local method the request came from
|
|
690
|
+
* @param overrides (optional) - a `ClientConfig` object type to override request data
|
|
691
|
+
*/
|
|
692
|
+
type AptosRequest = {
|
|
693
|
+
url: string;
|
|
694
|
+
method: "GET" | "POST";
|
|
695
|
+
path?: string;
|
|
696
|
+
body?: any;
|
|
697
|
+
contentType?: string;
|
|
698
|
+
acceptType?: string;
|
|
699
|
+
params?: Record<string, string | AnyNumber | boolean | undefined>;
|
|
700
|
+
originMethod?: string;
|
|
701
|
+
overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* Specifies ledger version of transactions. By default latest version will be used
|
|
705
|
+
*/
|
|
706
|
+
type LedgerVersionArg = {
|
|
707
|
+
ledgerVersion?: AnyNumber;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* RESPONSE TYPES
|
|
711
|
+
*/
|
|
712
|
+
/**
|
|
713
|
+
* Type holding the outputs of the estimate gas API
|
|
714
|
+
*/
|
|
715
|
+
type GasEstimation = {
|
|
716
|
+
/**
|
|
717
|
+
* The deprioritized estimate for the gas unit price
|
|
718
|
+
*/
|
|
719
|
+
deprioritized_gas_estimate?: number;
|
|
720
|
+
/**
|
|
721
|
+
* The current estimate for the gas unit price
|
|
722
|
+
*/
|
|
723
|
+
gas_estimate: number;
|
|
724
|
+
/**
|
|
725
|
+
* The prioritized estimate for the gas unit price
|
|
726
|
+
*/
|
|
727
|
+
prioritized_gas_estimate?: number;
|
|
728
|
+
};
|
|
729
|
+
type MoveResource = {
|
|
730
|
+
type: MoveStructId;
|
|
731
|
+
data: {};
|
|
732
|
+
};
|
|
733
|
+
type AccountData = {
|
|
734
|
+
sequence_number: string;
|
|
735
|
+
authentication_key: string;
|
|
736
|
+
};
|
|
737
|
+
type MoveModuleBytecode = {
|
|
738
|
+
bytecode: string;
|
|
739
|
+
abi?: MoveModule;
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* TRANSACTION TYPES
|
|
743
|
+
*/
|
|
744
|
+
declare enum TransactionResponseType {
|
|
745
|
+
Pending = "pending_transaction",
|
|
746
|
+
User = "user_transaction",
|
|
747
|
+
Genesis = "genesis_transaction",
|
|
748
|
+
BlockMetadata = "block_metadata_transaction",
|
|
749
|
+
StateCheckpoint = "state_checkpoint_transaction",
|
|
750
|
+
Validator = "validator_transaction"
|
|
751
|
+
}
|
|
752
|
+
type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;
|
|
753
|
+
type CommittedTransactionResponse = UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse | StateCheckpointTransactionResponse | ValidatorTransactionResponse;
|
|
754
|
+
declare function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse;
|
|
755
|
+
declare function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse;
|
|
756
|
+
declare function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse;
|
|
757
|
+
declare function isBlockMetadataTransactionResponse(response: TransactionResponse): response is BlockMetadataTransactionResponse;
|
|
758
|
+
declare function isStateCheckpointTransactionResponse(response: TransactionResponse): response is StateCheckpointTransactionResponse;
|
|
759
|
+
declare function isValidatorTransactionResponse(response: TransactionResponse): response is ValidatorTransactionResponse;
|
|
760
|
+
type PendingTransactionResponse = {
|
|
761
|
+
type: TransactionResponseType.Pending;
|
|
762
|
+
hash: string;
|
|
763
|
+
sender: string;
|
|
764
|
+
sequence_number: string;
|
|
765
|
+
max_gas_amount: string;
|
|
766
|
+
gas_unit_price: string;
|
|
767
|
+
expiration_timestamp_secs: string;
|
|
768
|
+
payload: TransactionPayloadResponse;
|
|
769
|
+
signature?: TransactionSignature;
|
|
770
|
+
};
|
|
771
|
+
type UserTransactionResponse = {
|
|
772
|
+
type: TransactionResponseType.User;
|
|
773
|
+
version: string;
|
|
774
|
+
hash: string;
|
|
775
|
+
state_change_hash: string;
|
|
776
|
+
event_root_hash: string;
|
|
777
|
+
state_checkpoint_hash: string | null;
|
|
778
|
+
gas_used: string;
|
|
779
|
+
/**
|
|
780
|
+
* Whether the transaction was successful
|
|
781
|
+
*/
|
|
782
|
+
success: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
785
|
+
*/
|
|
786
|
+
vm_status: string;
|
|
787
|
+
accumulator_root_hash: string;
|
|
788
|
+
/**
|
|
789
|
+
* Final state of resources changed by the transaction
|
|
790
|
+
*/
|
|
791
|
+
changes: Array<WriteSetChange>;
|
|
792
|
+
sender: string;
|
|
793
|
+
sequence_number: string;
|
|
794
|
+
max_gas_amount: string;
|
|
795
|
+
gas_unit_price: string;
|
|
796
|
+
expiration_timestamp_secs: string;
|
|
797
|
+
payload: TransactionPayloadResponse;
|
|
798
|
+
signature?: TransactionSignature;
|
|
799
|
+
/**
|
|
800
|
+
* Events generated by the transaction
|
|
801
|
+
*/
|
|
802
|
+
events: Array<Event>;
|
|
803
|
+
timestamp: string;
|
|
804
|
+
};
|
|
805
|
+
type GenesisTransactionResponse = {
|
|
806
|
+
type: TransactionResponseType.Genesis;
|
|
807
|
+
version: string;
|
|
808
|
+
hash: string;
|
|
809
|
+
state_change_hash: string;
|
|
810
|
+
event_root_hash: string;
|
|
811
|
+
state_checkpoint_hash?: string;
|
|
812
|
+
gas_used: string;
|
|
813
|
+
/**
|
|
814
|
+
* Whether the transaction was successful
|
|
815
|
+
*/
|
|
816
|
+
success: boolean;
|
|
817
|
+
/**
|
|
818
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
819
|
+
*/
|
|
820
|
+
vm_status: string;
|
|
821
|
+
accumulator_root_hash: string;
|
|
822
|
+
/**
|
|
823
|
+
* Final state of resources changed by the transaction
|
|
824
|
+
*/
|
|
825
|
+
changes: Array<WriteSetChange>;
|
|
826
|
+
payload: GenesisPayload;
|
|
827
|
+
/**
|
|
828
|
+
* Events emitted during genesis
|
|
829
|
+
*/
|
|
830
|
+
events: Array<Event>;
|
|
831
|
+
};
|
|
832
|
+
type BlockMetadataTransactionResponse = {
|
|
833
|
+
type: TransactionResponseType.BlockMetadata;
|
|
834
|
+
version: string;
|
|
835
|
+
hash: string;
|
|
836
|
+
state_change_hash: string;
|
|
837
|
+
event_root_hash: string;
|
|
838
|
+
state_checkpoint_hash: string | null;
|
|
839
|
+
gas_used: string;
|
|
840
|
+
/**
|
|
841
|
+
* Whether the transaction was successful
|
|
842
|
+
*/
|
|
843
|
+
success: boolean;
|
|
844
|
+
/**
|
|
845
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
846
|
+
*/
|
|
847
|
+
vm_status: string;
|
|
848
|
+
accumulator_root_hash: string;
|
|
849
|
+
/**
|
|
850
|
+
* Final state of resources changed by the transaction
|
|
851
|
+
*/
|
|
852
|
+
changes: Array<WriteSetChange>;
|
|
853
|
+
id: string;
|
|
854
|
+
epoch: string;
|
|
855
|
+
round: string;
|
|
856
|
+
/**
|
|
857
|
+
* The events emitted at the block creation
|
|
858
|
+
*/
|
|
859
|
+
events: Array<Event>;
|
|
860
|
+
/**
|
|
861
|
+
* Previous block votes
|
|
862
|
+
*/
|
|
863
|
+
previous_block_votes_bitvec: Array<number>;
|
|
864
|
+
proposer: string;
|
|
865
|
+
/**
|
|
866
|
+
* The indices of the proposers who failed to propose
|
|
867
|
+
*/
|
|
868
|
+
failed_proposer_indices: Array<number>;
|
|
869
|
+
timestamp: string;
|
|
870
|
+
};
|
|
871
|
+
type StateCheckpointTransactionResponse = {
|
|
872
|
+
type: TransactionResponseType.StateCheckpoint;
|
|
873
|
+
version: string;
|
|
874
|
+
hash: string;
|
|
875
|
+
state_change_hash: string;
|
|
876
|
+
event_root_hash: string;
|
|
877
|
+
state_checkpoint_hash: string | null;
|
|
878
|
+
gas_used: string;
|
|
879
|
+
/**
|
|
880
|
+
* Whether the transaction was successful
|
|
881
|
+
*/
|
|
882
|
+
success: boolean;
|
|
883
|
+
/**
|
|
884
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
885
|
+
*/
|
|
886
|
+
vm_status: string;
|
|
887
|
+
accumulator_root_hash: string;
|
|
888
|
+
/**
|
|
889
|
+
* Final state of resources changed by the transaction
|
|
890
|
+
*/
|
|
891
|
+
changes: Array<WriteSetChange>;
|
|
892
|
+
timestamp: string;
|
|
893
|
+
};
|
|
894
|
+
type ValidatorTransactionResponse = {
|
|
895
|
+
type: TransactionResponseType.Validator;
|
|
896
|
+
version: string;
|
|
897
|
+
hash: string;
|
|
898
|
+
state_change_hash: string;
|
|
899
|
+
event_root_hash: string;
|
|
900
|
+
state_checkpoint_hash: string | null;
|
|
901
|
+
gas_used: string;
|
|
902
|
+
/**
|
|
903
|
+
* Whether the transaction was successful
|
|
904
|
+
*/
|
|
905
|
+
success: boolean;
|
|
906
|
+
/**
|
|
907
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
908
|
+
*/
|
|
909
|
+
vm_status: string;
|
|
910
|
+
accumulator_root_hash: string;
|
|
911
|
+
/**
|
|
912
|
+
* Final state of resources changed by the transaction
|
|
913
|
+
*/
|
|
914
|
+
changes: Array<WriteSetChange>;
|
|
915
|
+
/**
|
|
916
|
+
* The events emitted by the validator transaction
|
|
917
|
+
*/
|
|
918
|
+
events: Array<Event>;
|
|
919
|
+
timestamp: string;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
* WRITESET CHANGE TYPES
|
|
923
|
+
*/
|
|
924
|
+
type WriteSetChange = WriteSetChangeDeleteModule | WriteSetChangeDeleteResource | WriteSetChangeDeleteTableItem | WriteSetChangeWriteModule | WriteSetChangeWriteResource | WriteSetChangeWriteTableItem;
|
|
925
|
+
type WriteSetChangeDeleteModule = {
|
|
926
|
+
type: string;
|
|
927
|
+
address: string;
|
|
928
|
+
/**
|
|
929
|
+
* State key hash
|
|
930
|
+
*/
|
|
931
|
+
state_key_hash: string;
|
|
932
|
+
module: MoveModuleId;
|
|
933
|
+
};
|
|
934
|
+
type WriteSetChangeDeleteResource = {
|
|
935
|
+
type: string;
|
|
936
|
+
address: string;
|
|
937
|
+
state_key_hash: string;
|
|
938
|
+
resource: string;
|
|
939
|
+
};
|
|
940
|
+
type WriteSetChangeDeleteTableItem = {
|
|
941
|
+
type: string;
|
|
942
|
+
state_key_hash: string;
|
|
943
|
+
handle: string;
|
|
944
|
+
key: string;
|
|
945
|
+
data?: DeletedTableData;
|
|
946
|
+
};
|
|
947
|
+
type WriteSetChangeWriteModule = {
|
|
948
|
+
type: string;
|
|
949
|
+
address: string;
|
|
950
|
+
state_key_hash: string;
|
|
951
|
+
data: MoveModuleBytecode;
|
|
952
|
+
};
|
|
953
|
+
type WriteSetChangeWriteResource = {
|
|
954
|
+
type: string;
|
|
955
|
+
address: string;
|
|
956
|
+
state_key_hash: string;
|
|
957
|
+
data: MoveResource;
|
|
958
|
+
};
|
|
959
|
+
type WriteSetChangeWriteTableItem = {
|
|
960
|
+
type: string;
|
|
961
|
+
state_key_hash: string;
|
|
962
|
+
handle: string;
|
|
963
|
+
key: string;
|
|
964
|
+
value: string;
|
|
965
|
+
data?: DecodedTableData;
|
|
966
|
+
};
|
|
967
|
+
type DecodedTableData = {
|
|
968
|
+
/**
|
|
969
|
+
* Key of table in JSON
|
|
970
|
+
*/
|
|
971
|
+
key: any;
|
|
972
|
+
/**
|
|
973
|
+
* Type of key
|
|
974
|
+
*/
|
|
975
|
+
key_type: string;
|
|
976
|
+
/**
|
|
977
|
+
* Value of table in JSON
|
|
978
|
+
*/
|
|
979
|
+
value: any;
|
|
980
|
+
/**
|
|
981
|
+
* Type of value
|
|
982
|
+
*/
|
|
983
|
+
value_type: string;
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* Deleted table data
|
|
987
|
+
*/
|
|
988
|
+
type DeletedTableData = {
|
|
989
|
+
/**
|
|
990
|
+
* Deleted key
|
|
991
|
+
*/
|
|
992
|
+
key: any;
|
|
993
|
+
/**
|
|
994
|
+
* Deleted key type
|
|
995
|
+
*/
|
|
996
|
+
key_type: string;
|
|
997
|
+
};
|
|
998
|
+
type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;
|
|
999
|
+
type EntryFunctionPayloadResponse = {
|
|
1000
|
+
type: string;
|
|
1001
|
+
function: MoveFunctionId;
|
|
1002
|
+
/**
|
|
1003
|
+
* Type arguments of the function
|
|
1004
|
+
*/
|
|
1005
|
+
type_arguments: Array<string>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Arguments of the function
|
|
1008
|
+
*/
|
|
1009
|
+
arguments: Array<any>;
|
|
1010
|
+
};
|
|
1011
|
+
type ScriptPayloadResponse = {
|
|
1012
|
+
type: string;
|
|
1013
|
+
code: MoveScriptBytecode;
|
|
1014
|
+
/**
|
|
1015
|
+
* Type arguments of the function
|
|
1016
|
+
*/
|
|
1017
|
+
type_arguments: Array<string>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Arguments of the function
|
|
1020
|
+
*/
|
|
1021
|
+
arguments: Array<any>;
|
|
1022
|
+
};
|
|
1023
|
+
type MultisigPayloadResponse = {
|
|
1024
|
+
type: string;
|
|
1025
|
+
multisig_address: string;
|
|
1026
|
+
transaction_payload?: EntryFunctionPayloadResponse;
|
|
1027
|
+
};
|
|
1028
|
+
type GenesisPayload = {
|
|
1029
|
+
type: string;
|
|
1030
|
+
write_set: WriteSet;
|
|
1031
|
+
};
|
|
1032
|
+
/**
|
|
1033
|
+
* Move script bytecode
|
|
1034
|
+
*/
|
|
1035
|
+
type MoveScriptBytecode = {
|
|
1036
|
+
bytecode: string;
|
|
1037
|
+
abi?: MoveFunction;
|
|
1038
|
+
};
|
|
1039
|
+
/**
|
|
1040
|
+
* These are the JSON representations of transaction signatures returned from the node API.
|
|
1041
|
+
*/
|
|
1042
|
+
type TransactionSignature = TransactionEd25519Signature | TransactionSecp256k1Signature | TransactionMultiEd25519Signature | TransactionMultiAgentSignature | TransactionFeePayerSignature;
|
|
1043
|
+
declare function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature;
|
|
1044
|
+
declare function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature;
|
|
1045
|
+
declare function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature;
|
|
1046
|
+
declare function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature;
|
|
1047
|
+
declare function isMultiEd25519Signature(signature: TransactionSignature): signature is TransactionMultiEd25519Signature;
|
|
1048
|
+
type TransactionEd25519Signature = {
|
|
1049
|
+
type: string;
|
|
1050
|
+
public_key: string;
|
|
1051
|
+
signature: "ed25519_signature";
|
|
1052
|
+
};
|
|
1053
|
+
type TransactionSecp256k1Signature = {
|
|
1054
|
+
type: string;
|
|
1055
|
+
public_key: string;
|
|
1056
|
+
signature: "secp256k1_ecdsa_signature";
|
|
1057
|
+
};
|
|
1058
|
+
type TransactionMultiEd25519Signature = {
|
|
1059
|
+
type: "multi_ed25519_signature";
|
|
1060
|
+
/**
|
|
1061
|
+
* The public keys for the Ed25519 signature
|
|
1062
|
+
*/
|
|
1063
|
+
public_keys: Array<string>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Signature associated with the public keys in the same order
|
|
1066
|
+
*/
|
|
1067
|
+
signatures: Array<string>;
|
|
1068
|
+
/**
|
|
1069
|
+
* The number of signatures required for a successful transaction
|
|
1070
|
+
*/
|
|
1071
|
+
threshold: number;
|
|
1072
|
+
bitmap: string;
|
|
1073
|
+
};
|
|
1074
|
+
type TransactionMultiAgentSignature = {
|
|
1075
|
+
type: "multi_agent_signature";
|
|
1076
|
+
sender: AccountSignature;
|
|
1077
|
+
/**
|
|
1078
|
+
* The other involved parties' addresses
|
|
1079
|
+
*/
|
|
1080
|
+
secondary_signer_addresses: Array<string>;
|
|
1081
|
+
/**
|
|
1082
|
+
* The associated signatures, in the same order as the secondary addresses
|
|
1083
|
+
*/
|
|
1084
|
+
secondary_signers: Array<AccountSignature>;
|
|
1085
|
+
};
|
|
1086
|
+
type TransactionFeePayerSignature = {
|
|
1087
|
+
type: "fee_payer_signature";
|
|
1088
|
+
sender: AccountSignature;
|
|
1089
|
+
/**
|
|
1090
|
+
* The other involved parties' addresses
|
|
1091
|
+
*/
|
|
1092
|
+
secondary_signer_addresses: Array<string>;
|
|
1093
|
+
/**
|
|
1094
|
+
* The associated signatures, in the same order as the secondary addresses
|
|
1095
|
+
*/
|
|
1096
|
+
secondary_signers: Array<AccountSignature>;
|
|
1097
|
+
fee_payer_address: string;
|
|
1098
|
+
fee_payer_signer: AccountSignature;
|
|
1099
|
+
};
|
|
1100
|
+
/**
|
|
1101
|
+
* The union of all single account signatures.
|
|
1102
|
+
*/
|
|
1103
|
+
type AccountSignature = TransactionEd25519Signature | TransactionSecp256k1Signature | TransactionMultiEd25519Signature;
|
|
1104
|
+
type WriteSet = ScriptWriteSet | DirectWriteSet;
|
|
1105
|
+
type ScriptWriteSet = {
|
|
1106
|
+
type: string;
|
|
1107
|
+
execute_as: string;
|
|
1108
|
+
script: ScriptPayloadResponse;
|
|
1109
|
+
};
|
|
1110
|
+
type DirectWriteSet = {
|
|
1111
|
+
type: string;
|
|
1112
|
+
changes: Array<WriteSetChange>;
|
|
1113
|
+
events: Array<Event>;
|
|
1114
|
+
};
|
|
1115
|
+
type EventGuid = {
|
|
1116
|
+
creation_number: string;
|
|
1117
|
+
account_address: string;
|
|
1118
|
+
};
|
|
1119
|
+
type Event = {
|
|
1120
|
+
guid: EventGuid;
|
|
1121
|
+
sequence_number: string;
|
|
1122
|
+
type: string;
|
|
1123
|
+
/**
|
|
1124
|
+
* The JSON representation of the event
|
|
1125
|
+
*/
|
|
1126
|
+
data: any;
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Map of Move types to local TypeScript types
|
|
1130
|
+
*/
|
|
1131
|
+
type MoveUint8Type = number;
|
|
1132
|
+
type MoveUint16Type = number;
|
|
1133
|
+
type MoveUint32Type = number;
|
|
1134
|
+
type MoveUint64Type = string;
|
|
1135
|
+
type MoveUint128Type = string;
|
|
1136
|
+
type MoveUint256Type = string;
|
|
1137
|
+
type MoveAddressType = string;
|
|
1138
|
+
type MoveObjectType = string;
|
|
1139
|
+
type MoveOptionType = MoveType | null | undefined;
|
|
1140
|
+
/**
|
|
1141
|
+
* This is the format for a fully qualified struct, resource, or entry function in Move.
|
|
1142
|
+
*/
|
|
1143
|
+
type MoveStructId = `${string}::${string}::${string}`;
|
|
1144
|
+
type MoveFunctionId = MoveStructId;
|
|
1145
|
+
type MoveStructType = {};
|
|
1146
|
+
type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructType | Array<MoveType>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Possible Move values acceptable by move functions (entry, view)
|
|
1149
|
+
*
|
|
1150
|
+
* Map of a Move value to the corresponding TypeScript value
|
|
1151
|
+
*
|
|
1152
|
+
* `Bool -> boolean`
|
|
1153
|
+
*
|
|
1154
|
+
* `u8, u16, u32 -> number`
|
|
1155
|
+
*
|
|
1156
|
+
* `u64, u128, u256 -> string`
|
|
1157
|
+
*
|
|
1158
|
+
* `String -> string`
|
|
1159
|
+
*
|
|
1160
|
+
* `Address -> 0x${string}`
|
|
1161
|
+
*
|
|
1162
|
+
* `Struct - 0x${string}::${string}::${string}`
|
|
1163
|
+
*
|
|
1164
|
+
* `Object -> 0x${string}`
|
|
1165
|
+
*
|
|
1166
|
+
* `Vector -> Array<MoveValue>`
|
|
1167
|
+
*
|
|
1168
|
+
* `Option -> MoveValue | null | undefined`
|
|
1169
|
+
*/
|
|
1170
|
+
type MoveValue = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructId | MoveOptionType | Array<MoveValue>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Move module id is a string representation of Move module.
|
|
1173
|
+
* Module name is case-sensitive.
|
|
1174
|
+
*/
|
|
1175
|
+
type MoveModuleId = `${string}::${string}`;
|
|
1176
|
+
/**
|
|
1177
|
+
* Move function visibility
|
|
1178
|
+
*/
|
|
1179
|
+
declare enum MoveFunctionVisibility {
|
|
1180
|
+
PRIVATE = "private",
|
|
1181
|
+
PUBLIC = "public",
|
|
1182
|
+
FRIEND = "friend"
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Move function ability
|
|
1186
|
+
*/
|
|
1187
|
+
declare enum MoveAbility {
|
|
1188
|
+
STORE = "store",
|
|
1189
|
+
DROP = "drop",
|
|
1190
|
+
KEY = "key",
|
|
1191
|
+
COPY = "copy"
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Move abilities tied to the generic type param and associated with the function that uses it
|
|
1195
|
+
*/
|
|
1196
|
+
type MoveFunctionGenericTypeParam = {
|
|
1197
|
+
constraints: Array<MoveAbility>;
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* Move struct field
|
|
1201
|
+
*/
|
|
1202
|
+
type MoveStructField = {
|
|
1203
|
+
name: string;
|
|
1204
|
+
type: string;
|
|
1205
|
+
};
|
|
1206
|
+
/**
|
|
1207
|
+
* A Move module
|
|
1208
|
+
*/
|
|
1209
|
+
type MoveModule = {
|
|
1210
|
+
address: string;
|
|
1211
|
+
name: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* Friends of the module
|
|
1214
|
+
*/
|
|
1215
|
+
friends: Array<MoveModuleId>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Public functions of the module
|
|
1218
|
+
*/
|
|
1219
|
+
exposed_functions: Array<MoveFunction>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Structs of the module
|
|
1222
|
+
*/
|
|
1223
|
+
structs: Array<MoveStruct>;
|
|
1224
|
+
};
|
|
1225
|
+
/**
|
|
1226
|
+
* A move struct
|
|
1227
|
+
*/
|
|
1228
|
+
type MoveStruct = {
|
|
1229
|
+
name: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* Whether the struct is a native struct of Move
|
|
1232
|
+
*/
|
|
1233
|
+
is_native: boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* Abilities associated with the struct
|
|
1236
|
+
*/
|
|
1237
|
+
abilities: Array<MoveAbility>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Generic types associated with the struct
|
|
1240
|
+
*/
|
|
1241
|
+
generic_type_params: Array<MoveFunctionGenericTypeParam>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Fields associated with the struct
|
|
1244
|
+
*/
|
|
1245
|
+
fields: Array<MoveStructField>;
|
|
1246
|
+
};
|
|
1247
|
+
/**
|
|
1248
|
+
* Move function
|
|
1249
|
+
*/
|
|
1250
|
+
type MoveFunction = {
|
|
1251
|
+
name: string;
|
|
1252
|
+
visibility: MoveFunctionVisibility;
|
|
1253
|
+
/**
|
|
1254
|
+
* Whether the function can be called as an entry function directly in a transaction
|
|
1255
|
+
*/
|
|
1256
|
+
is_entry: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* Whether the function is a view function or not
|
|
1259
|
+
*/
|
|
1260
|
+
is_view: boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* Generic type params associated with the Move function
|
|
1263
|
+
*/
|
|
1264
|
+
generic_type_params: Array<MoveFunctionGenericTypeParam>;
|
|
1265
|
+
/**
|
|
1266
|
+
* Parameters associated with the move function
|
|
1267
|
+
*/
|
|
1268
|
+
params: Array<string>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Return type of the function
|
|
1271
|
+
*/
|
|
1272
|
+
return: Array<string>;
|
|
1273
|
+
};
|
|
1274
|
+
declare enum RoleType {
|
|
1275
|
+
VALIDATOR = "validator",
|
|
1276
|
+
FULL_NODE = "full_node"
|
|
1277
|
+
}
|
|
1278
|
+
type LedgerInfo = {
|
|
1279
|
+
/**
|
|
1280
|
+
* Chain ID of the current chain
|
|
1281
|
+
*/
|
|
1282
|
+
chain_id: number;
|
|
1283
|
+
epoch: string;
|
|
1284
|
+
ledger_version: string;
|
|
1285
|
+
oldest_ledger_version: string;
|
|
1286
|
+
ledger_timestamp: string;
|
|
1287
|
+
node_role: RoleType;
|
|
1288
|
+
oldest_block_height: string;
|
|
1289
|
+
block_height: string;
|
|
1290
|
+
/**
|
|
1291
|
+
* Git hash of the build of the API endpoint. Can be used to determine the exact
|
|
1292
|
+
* software version used by the API endpoint.
|
|
1293
|
+
*/
|
|
1294
|
+
git_hash?: string;
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* A Block type
|
|
1298
|
+
*/
|
|
1299
|
+
type Block = {
|
|
1300
|
+
block_height: string;
|
|
1301
|
+
block_hash: string;
|
|
1302
|
+
block_timestamp: string;
|
|
1303
|
+
first_version: string;
|
|
1304
|
+
last_version: string;
|
|
1305
|
+
/**
|
|
1306
|
+
* The transactions in the block in sequential order
|
|
1307
|
+
*/
|
|
1308
|
+
transactions?: Array<TransactionResponse>;
|
|
1309
|
+
};
|
|
1310
|
+
/**
|
|
1311
|
+
* Table Item request for the GetTableItem API
|
|
1312
|
+
*/
|
|
1313
|
+
type TableItemRequest = {
|
|
1314
|
+
key_type: MoveValue;
|
|
1315
|
+
value_type: MoveValue;
|
|
1316
|
+
/**
|
|
1317
|
+
* The value of the table item's key
|
|
1318
|
+
*/
|
|
1319
|
+
key: any;
|
|
1320
|
+
};
|
|
1321
|
+
/**
|
|
1322
|
+
* A list of Authentication Key schemes that are supported by Aptos.
|
|
1323
|
+
*
|
|
1324
|
+
* They are combinations of signing schemes and derive schemes.
|
|
1325
|
+
*/
|
|
1326
|
+
type AuthenticationKeyScheme = SigningScheme | DeriveScheme;
|
|
1327
|
+
declare enum SigningScheme {
|
|
1328
|
+
/**
|
|
1329
|
+
* For Ed25519PublicKey
|
|
1330
|
+
*/
|
|
1331
|
+
Ed25519 = 0,
|
|
1332
|
+
/**
|
|
1333
|
+
* For MultiEd25519PublicKey
|
|
1334
|
+
*/
|
|
1335
|
+
MultiEd25519 = 1,
|
|
1336
|
+
/**
|
|
1337
|
+
* For SingleKey ecdsa
|
|
1338
|
+
*/
|
|
1339
|
+
SingleKey = 2,
|
|
1340
|
+
MultiKey = 3
|
|
1341
|
+
}
|
|
1342
|
+
declare enum SigningSchemeInput {
|
|
1343
|
+
/**
|
|
1344
|
+
* For Ed25519PublicKey
|
|
1345
|
+
*/
|
|
1346
|
+
Ed25519 = 0,
|
|
1347
|
+
/**
|
|
1348
|
+
* For Secp256k1Ecdsa
|
|
1349
|
+
*/
|
|
1350
|
+
Secp256k1Ecdsa = 2
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Scheme used for deriving account addresses from other data
|
|
1354
|
+
*/
|
|
1355
|
+
declare enum DeriveScheme {
|
|
1356
|
+
/**
|
|
1357
|
+
* Derives an address using an AUID, used for objects
|
|
1358
|
+
*/
|
|
1359
|
+
DeriveAuid = 251,
|
|
1360
|
+
/**
|
|
1361
|
+
* Derives an address from another object address
|
|
1362
|
+
*/
|
|
1363
|
+
DeriveObjectAddressFromObject = 252,
|
|
1364
|
+
/**
|
|
1365
|
+
* Derives an address from a GUID, used for objects
|
|
1366
|
+
*/
|
|
1367
|
+
DeriveObjectAddressFromGuid = 253,
|
|
1368
|
+
/**
|
|
1369
|
+
* Derives an address from seed bytes, used for named objects
|
|
1370
|
+
*/
|
|
1371
|
+
DeriveObjectAddressFromSeed = 254,
|
|
1372
|
+
/**
|
|
1373
|
+
* Derives an address from seed bytes, used for resource accounts
|
|
1374
|
+
*/
|
|
1375
|
+
DeriveResourceAccountAddress = 255
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Option properties to pass for waitForTransaction() function
|
|
1379
|
+
*/
|
|
1380
|
+
type WaitForTransactionOptions = {
|
|
1381
|
+
timeoutSecs?: number;
|
|
1382
|
+
checkSuccess?: boolean;
|
|
1383
|
+
waitForIndexer?: boolean;
|
|
1384
|
+
};
|
|
1385
|
+
/**
|
|
1386
|
+
* Input type to generate an account using Single Signer
|
|
1387
|
+
* Ed25519 or Legacy Ed25519
|
|
1388
|
+
*/
|
|
1389
|
+
type GenerateAccountWithEd25519 = {
|
|
1390
|
+
scheme: SigningSchemeInput.Ed25519;
|
|
1391
|
+
legacy: boolean;
|
|
1392
|
+
};
|
|
1393
|
+
/**
|
|
1394
|
+
* Input type to generate an account using Single Signer
|
|
1395
|
+
* Secp256k1
|
|
1396
|
+
*/
|
|
1397
|
+
type GenerateAccountWithSingleSignerSecp256k1Key = {
|
|
1398
|
+
scheme: SigningSchemeInput.Secp256k1Ecdsa;
|
|
1399
|
+
legacy?: false;
|
|
1400
|
+
};
|
|
1401
|
+
type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* This interface exists to define Deserializable<T> inputs for functions that
|
|
1405
|
+
* deserialize a byte buffer into a type T.
|
|
1406
|
+
* It is not intended to be implemented or extended, because Typescript has no support
|
|
1407
|
+
* for static methods in interfaces.
|
|
1408
|
+
*/
|
|
1409
|
+
interface Deserializable<T> {
|
|
1410
|
+
deserialize(deserializer: Deserializer): T;
|
|
1411
|
+
}
|
|
1412
|
+
declare class Deserializer {
|
|
1413
|
+
private buffer;
|
|
1414
|
+
private offset;
|
|
1415
|
+
constructor(data: Uint8Array);
|
|
1416
|
+
private read;
|
|
1417
|
+
/**
|
|
1418
|
+
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
1419
|
+
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
1420
|
+
*
|
|
1421
|
+
* BCS layout for "string": string_length | string_content
|
|
1422
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1423
|
+
*
|
|
1424
|
+
* @example
|
|
1425
|
+
* ```ts
|
|
1426
|
+
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1427
|
+
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
1428
|
+
* ```
|
|
1429
|
+
*/
|
|
1430
|
+
deserializeStr(): string;
|
|
1431
|
+
/**
|
|
1432
|
+
* Deserializes an array of bytes.
|
|
1433
|
+
*
|
|
1434
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1435
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1436
|
+
*/
|
|
1437
|
+
deserializeBytes(): Uint8Array;
|
|
1438
|
+
/**
|
|
1439
|
+
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
1440
|
+
*
|
|
1441
|
+
*/
|
|
1442
|
+
deserializeFixedBytes(len: number): Uint8Array;
|
|
1443
|
+
/**
|
|
1444
|
+
* Deserializes a boolean value.
|
|
1445
|
+
*
|
|
1446
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1447
|
+
*/
|
|
1448
|
+
deserializeBool(): boolean;
|
|
1449
|
+
/**
|
|
1450
|
+
* Deserializes a uint8 number.
|
|
1451
|
+
*
|
|
1452
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1453
|
+
*/
|
|
1454
|
+
deserializeU8(): Uint8;
|
|
1455
|
+
/**
|
|
1456
|
+
* Deserializes a uint16 number.
|
|
1457
|
+
*
|
|
1458
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1459
|
+
* @example
|
|
1460
|
+
* ```ts
|
|
1461
|
+
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
1462
|
+
* assert(deserializer.deserializeU16() === 4660);
|
|
1463
|
+
* ```
|
|
1464
|
+
*/
|
|
1465
|
+
deserializeU16(): Uint16;
|
|
1466
|
+
/**
|
|
1467
|
+
* Deserializes a uint32 number.
|
|
1468
|
+
*
|
|
1469
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```ts
|
|
1472
|
+
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1473
|
+
* assert(deserializer.deserializeU32() === 305419896);
|
|
1474
|
+
* ```
|
|
1475
|
+
*/
|
|
1476
|
+
deserializeU32(): Uint32;
|
|
1477
|
+
/**
|
|
1478
|
+
* Deserializes a uint64 number.
|
|
1479
|
+
*
|
|
1480
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1481
|
+
* @example
|
|
1482
|
+
* ```ts
|
|
1483
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1484
|
+
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
1485
|
+
* ```
|
|
1486
|
+
*/
|
|
1487
|
+
deserializeU64(): Uint64;
|
|
1488
|
+
/**
|
|
1489
|
+
* Deserializes a uint128 number.
|
|
1490
|
+
*
|
|
1491
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1492
|
+
*/
|
|
1493
|
+
deserializeU128(): Uint128;
|
|
1494
|
+
/**
|
|
1495
|
+
* Deserializes a uint256 number.
|
|
1496
|
+
*
|
|
1497
|
+
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
1498
|
+
*/
|
|
1499
|
+
deserializeU256(): Uint256;
|
|
1500
|
+
/**
|
|
1501
|
+
* Deserializes a uleb128 encoded uint32 number.
|
|
1502
|
+
*
|
|
1503
|
+
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1504
|
+
*/
|
|
1505
|
+
deserializeUleb128AsU32(): Uint32;
|
|
1506
|
+
/**
|
|
1507
|
+
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
1508
|
+
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
1509
|
+
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
1510
|
+
*
|
|
1511
|
+
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
1512
|
+
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
1513
|
+
* // value is now an instance of MyClass
|
|
1514
|
+
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
1515
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1516
|
+
*
|
|
1517
|
+
* @returns the deserialized value of class type T
|
|
1518
|
+
*/
|
|
1519
|
+
deserialize<T>(cls: Deserializable<T>): T;
|
|
1520
|
+
/**
|
|
1521
|
+
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
1522
|
+
* instance with a loaded byte buffer.
|
|
1523
|
+
*
|
|
1524
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1525
|
+
* @example
|
|
1526
|
+
* // serialize a vector of addresses
|
|
1527
|
+
* const addresses = new Array<AccountAddress>(
|
|
1528
|
+
* AccountAddress.from("0x1"),
|
|
1529
|
+
* AccountAddress.from("0x2"),
|
|
1530
|
+
* AccountAddress.from("0xa"),
|
|
1531
|
+
* AccountAddress.from("0xb"),
|
|
1532
|
+
* );
|
|
1533
|
+
* const serializer = new Serializer();
|
|
1534
|
+
* serializer.serializeVector(addresses);
|
|
1535
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1536
|
+
*
|
|
1537
|
+
* // deserialize the bytes into an array of addresses
|
|
1538
|
+
* const deserializer = new Deserializer(serializedBytes);
|
|
1539
|
+
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
1540
|
+
* // deserializedAddresses is now an array of AccountAddress instances
|
|
1541
|
+
* @returns an array of deserialized values of type T
|
|
1542
|
+
*/
|
|
1543
|
+
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* This error is used to explain why parsing failed.
|
|
1548
|
+
*/
|
|
1549
|
+
declare class ParsingError<T> extends Error {
|
|
1550
|
+
/**
|
|
1551
|
+
* This provides a programmatic way to access why parsing failed. Downstream devs
|
|
1552
|
+
* might want to use this to build their own error messages if the default error
|
|
1553
|
+
* messages are not suitable for their use case. This should be an enum.
|
|
1554
|
+
*/
|
|
1555
|
+
invalidReason: T;
|
|
1556
|
+
constructor(message: string, invalidReason: T);
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
|
|
1560
|
+
* this type is returned from "defensive" functions like isValid.
|
|
1561
|
+
*/
|
|
1562
|
+
type ParsingResult<T> = {
|
|
1563
|
+
/**
|
|
1564
|
+
* True if valid, false otherwise.
|
|
1565
|
+
*/
|
|
1566
|
+
valid: boolean;
|
|
1567
|
+
/**
|
|
1568
|
+
* If valid is false, this will be a code explaining why parsing failed.
|
|
1569
|
+
*/
|
|
1570
|
+
invalidReason?: T;
|
|
1571
|
+
/**
|
|
1572
|
+
* If valid is false, this will be a string explaining why parsing failed.
|
|
1573
|
+
*/
|
|
1574
|
+
invalidReasonMessage?: string;
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* This enum is used to explain why parsing might have failed.
|
|
1579
|
+
*/
|
|
1580
|
+
declare enum HexInvalidReason {
|
|
1581
|
+
TOO_SHORT = "too_short",
|
|
1582
|
+
INVALID_LENGTH = "invalid_length",
|
|
1583
|
+
INVALID_HEX_CHARS = "invalid_hex_chars"
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* NOTE: Do not use this class when working with account addresses, use AccountAddress.
|
|
1587
|
+
*
|
|
1588
|
+
* NOTE: When accepting hex data as input to a function, prefer to accept HexInput and
|
|
1589
|
+
* then use the static helper methods of this class to convert it into the desired
|
|
1590
|
+
* format. This enables the greatest flexibility for the developer.
|
|
1591
|
+
*
|
|
1592
|
+
* Hex is a helper class for working with hex data. Hex data, when represented as a
|
|
1593
|
+
* string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.
|
|
1594
|
+
*
|
|
1595
|
+
* You might use this class like this:
|
|
1596
|
+
*
|
|
1597
|
+
* ```ts
|
|
1598
|
+
* getTransactionByHash(txnHash: HexInput): Promise<Transaction> {
|
|
1599
|
+
* const txnHashString = Hex.fromHexInput(txnHash).toString();
|
|
1600
|
+
* return await getTransactionByHashInner(txnHashString);
|
|
1601
|
+
* }
|
|
1602
|
+
* ```
|
|
1603
|
+
*
|
|
1604
|
+
* This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string
|
|
1605
|
+
* with a leading 0x prefix, regardless of what the input format was.
|
|
1606
|
+
*
|
|
1607
|
+
* These are some other ways to chain the functions together:
|
|
1608
|
+
* - `Hex.fromHexString({ hexInput: "0x1f" }).toUint8Array()`
|
|
1609
|
+
* - `new Hex([1, 3]).toStringWithoutPrefix()`
|
|
1610
|
+
*/
|
|
1611
|
+
declare class Hex {
|
|
1612
|
+
private readonly data;
|
|
1613
|
+
/**
|
|
1614
|
+
* Create a new Hex instance from a Uint8Array.
|
|
1615
|
+
*
|
|
1616
|
+
* @param data Uint8Array
|
|
1617
|
+
*/
|
|
1618
|
+
constructor(data: Uint8Array);
|
|
1619
|
+
/**
|
|
1620
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
1621
|
+
* is taking place here, it just returns the inner data.
|
|
1622
|
+
*
|
|
1623
|
+
* @returns Hex data as Uint8Array
|
|
1624
|
+
*/
|
|
1625
|
+
toUint8Array(): Uint8Array;
|
|
1626
|
+
/**
|
|
1627
|
+
* Get the hex data as a string without the 0x prefix.
|
|
1628
|
+
*
|
|
1629
|
+
* @returns Hex string without 0x prefix
|
|
1630
|
+
*/
|
|
1631
|
+
toStringWithoutPrefix(): string;
|
|
1632
|
+
/**
|
|
1633
|
+
* Get the hex data as a string with the 0x prefix.
|
|
1634
|
+
*
|
|
1635
|
+
* @returns Hex string with 0x prefix
|
|
1636
|
+
*/
|
|
1637
|
+
toString(): string;
|
|
1638
|
+
/**
|
|
1639
|
+
* Static method to convert a hex string to Hex
|
|
1640
|
+
*
|
|
1641
|
+
* @param str A hex string, with or without the 0x prefix
|
|
1642
|
+
*
|
|
1643
|
+
* @returns Hex
|
|
1644
|
+
*/
|
|
1645
|
+
static fromHexString(str: string): Hex;
|
|
1646
|
+
/**
|
|
1647
|
+
* Static method to convert an instance of HexInput to Hex
|
|
1648
|
+
*
|
|
1649
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
1650
|
+
*
|
|
1651
|
+
* @returns Hex
|
|
1652
|
+
*/
|
|
1653
|
+
static fromHexInput(hexInput: HexInput): Hex;
|
|
1654
|
+
/**
|
|
1655
|
+
* Check if the string is valid hex.
|
|
1656
|
+
*
|
|
1657
|
+
* @param str A hex string representing byte data.
|
|
1658
|
+
*
|
|
1659
|
+
* @returns valid = true if the string is valid, false if not. If the string is not
|
|
1660
|
+
* valid, invalidReason and invalidReasonMessage will be set explaining why it is
|
|
1661
|
+
* invalid.
|
|
1662
|
+
*/
|
|
1663
|
+
static isValid(str: string): ParsingResult<HexInvalidReason>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Return whether Hex instances are equal. Hex instances are considered equal if
|
|
1666
|
+
* their underlying byte data is identical.
|
|
1667
|
+
*
|
|
1668
|
+
* @param other The Hex instance to compare to.
|
|
1669
|
+
* @returns true if the Hex instances are equal, false if not.
|
|
1670
|
+
*/
|
|
1671
|
+
equals(other: Hex): boolean;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
declare abstract class Serializable {
|
|
1675
|
+
abstract serialize(serializer: Serializer): void;
|
|
1676
|
+
/**
|
|
1677
|
+
* Serializes a `Serializable` value to its BCS representation.
|
|
1678
|
+
* This function is the Typescript SDK equivalent of `bcs::to_bytes` in Move.
|
|
1679
|
+
* @returns the BCS representation of the Serializable instance as a byte buffer
|
|
1680
|
+
*/
|
|
1681
|
+
bcsToBytes(): Uint8Array;
|
|
1682
|
+
/**
|
|
1683
|
+
* Helper function to get a value's BCS-serialized bytes as a Hex instance.
|
|
1684
|
+
* @returns a Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array
|
|
1685
|
+
*/
|
|
1686
|
+
bcsToHex(): Hex;
|
|
1687
|
+
}
|
|
1688
|
+
declare class Serializer {
|
|
1689
|
+
private buffer;
|
|
1690
|
+
private offset;
|
|
1691
|
+
constructor(length?: number);
|
|
1692
|
+
private ensureBufferWillHandleSize;
|
|
1693
|
+
protected appendToBuffer(values: Uint8Array): void;
|
|
1694
|
+
private serializeWithFunction;
|
|
1695
|
+
/**
|
|
1696
|
+
* Serializes a string. UTF8 string is supported.
|
|
1697
|
+
*
|
|
1698
|
+
* The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer.
|
|
1699
|
+
* Then the string content is serialized as UTF8 encoded bytes.
|
|
1700
|
+
*
|
|
1701
|
+
* BCS layout for "string": string_length | string_content
|
|
1702
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1703
|
+
*
|
|
1704
|
+
* @example
|
|
1705
|
+
* ```ts
|
|
1706
|
+
* const serializer = new Serializer();
|
|
1707
|
+
* serializer.serializeStr("1234abcd");
|
|
1708
|
+
* assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1709
|
+
* ```
|
|
1710
|
+
*/
|
|
1711
|
+
serializeStr(value: string): void;
|
|
1712
|
+
/**
|
|
1713
|
+
* Serializes an array of bytes.
|
|
1714
|
+
*
|
|
1715
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1716
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1717
|
+
*/
|
|
1718
|
+
serializeBytes(value: Uint8Array): void;
|
|
1719
|
+
/**
|
|
1720
|
+
* Serializes an array of bytes with known length. Therefore, length doesn't need to be
|
|
1721
|
+
* serialized to help deserialization.
|
|
1722
|
+
*
|
|
1723
|
+
* When deserializing, the number of bytes to deserialize needs to be passed in.
|
|
1724
|
+
*/
|
|
1725
|
+
serializeFixedBytes(value: Uint8Array): void;
|
|
1726
|
+
/**
|
|
1727
|
+
* Serializes a boolean value.
|
|
1728
|
+
*
|
|
1729
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1730
|
+
*/
|
|
1731
|
+
serializeBool(value: boolean): void;
|
|
1732
|
+
/**
|
|
1733
|
+
* Serializes a uint8 number.
|
|
1734
|
+
*
|
|
1735
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1736
|
+
*/
|
|
1737
|
+
serializeU8(value: Uint8): void;
|
|
1738
|
+
/**
|
|
1739
|
+
* Serializes a uint16 number.
|
|
1740
|
+
*
|
|
1741
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1742
|
+
* @example
|
|
1743
|
+
* ```ts
|
|
1744
|
+
* const serializer = new Serializer();
|
|
1745
|
+
* serializer.serializeU16(4660);
|
|
1746
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12]));
|
|
1747
|
+
* ```
|
|
1748
|
+
*/
|
|
1749
|
+
serializeU16(value: Uint16): void;
|
|
1750
|
+
/**
|
|
1751
|
+
* Serializes a uint32 number.
|
|
1752
|
+
*
|
|
1753
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1754
|
+
* @example
|
|
1755
|
+
* ```ts
|
|
1756
|
+
* const serializer = new Serializer();
|
|
1757
|
+
* serializer.serializeU32(305419896);
|
|
1758
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1759
|
+
* ```
|
|
1760
|
+
*/
|
|
1761
|
+
serializeU32(value: Uint32): void;
|
|
1762
|
+
/**
|
|
1763
|
+
* Serializes a uint64 number.
|
|
1764
|
+
*
|
|
1765
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1766
|
+
* @example
|
|
1767
|
+
* ```ts
|
|
1768
|
+
* const serializer = new Serializer();
|
|
1769
|
+
* serializer.serializeU64(1311768467750121216);
|
|
1770
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1771
|
+
* ```
|
|
1772
|
+
*/
|
|
1773
|
+
serializeU64(value: AnyNumber): void;
|
|
1774
|
+
/**
|
|
1775
|
+
* Serializes a uint128 number.
|
|
1776
|
+
*
|
|
1777
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1778
|
+
*/
|
|
1779
|
+
serializeU128(value: AnyNumber): void;
|
|
1780
|
+
/**
|
|
1781
|
+
* Serializes a uint256 number.
|
|
1782
|
+
*
|
|
1783
|
+
* BCS layout for "uint256": Sixteen bytes. Binary format in little-endian representation.
|
|
1784
|
+
*/
|
|
1785
|
+
serializeU256(value: AnyNumber): void;
|
|
1786
|
+
/**
|
|
1787
|
+
* Serializes a uint32 number with uleb128.
|
|
1788
|
+
*
|
|
1789
|
+
* BCS uses uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1790
|
+
*/
|
|
1791
|
+
serializeU32AsUleb128(val: Uint32): void;
|
|
1792
|
+
/**
|
|
1793
|
+
* Returns the buffered bytes
|
|
1794
|
+
*/
|
|
1795
|
+
toUint8Array(): Uint8Array;
|
|
1796
|
+
/**
|
|
1797
|
+
* Serializes a `Serializable` value, facilitating composable serialization.
|
|
1798
|
+
*
|
|
1799
|
+
* @param value The Serializable value to serialize
|
|
1800
|
+
*
|
|
1801
|
+
* @example
|
|
1802
|
+
* // Define the MoveStruct class that implements the Serializable interface
|
|
1803
|
+
* class MoveStruct extends Serializable {
|
|
1804
|
+
* constructor(
|
|
1805
|
+
* public creatorAddress: AccountAddress, // where AccountAddress extends Serializable
|
|
1806
|
+
* public collectionName: string,
|
|
1807
|
+
* public tokenName: string
|
|
1808
|
+
* ) {}
|
|
1809
|
+
*
|
|
1810
|
+
* serialize(serializer: Serializer): void {
|
|
1811
|
+
* serializer.serialize(this.creatorAddress); // Composable serialization of another Serializable object
|
|
1812
|
+
* serializer.serializeStr(this.collectionName);
|
|
1813
|
+
* serializer.serializeStr(this.tokenName);
|
|
1814
|
+
* }
|
|
1815
|
+
* }
|
|
1816
|
+
*
|
|
1817
|
+
* // Construct a MoveStruct
|
|
1818
|
+
* const moveStruct = new MoveStruct(new AccountAddress(...), "MyCollection", "TokenA");
|
|
1819
|
+
*
|
|
1820
|
+
* // Serialize a string, a u64 number, and a MoveStruct instance.
|
|
1821
|
+
* const serializer = new Serializer();
|
|
1822
|
+
* serializer.serializeStr("ExampleString");
|
|
1823
|
+
* serializer.serializeU64(12345678);
|
|
1824
|
+
* serializer.serialize(moveStruct);
|
|
1825
|
+
*
|
|
1826
|
+
* // Get the bytes from the Serializer instance
|
|
1827
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1828
|
+
*
|
|
1829
|
+
* @returns the serializer instance
|
|
1830
|
+
*/
|
|
1831
|
+
serialize<T extends Serializable>(value: T): void;
|
|
1832
|
+
/**
|
|
1833
|
+
* Serializes an array of BCS Serializable values to a serializer instance.
|
|
1834
|
+
* Note that this does not return anything. The bytes are added to the serializer instance's byte buffer.
|
|
1835
|
+
*
|
|
1836
|
+
* @param values The array of BCS Serializable values
|
|
1837
|
+
* @example
|
|
1838
|
+
* const addresses = new Array<AccountAddress>(
|
|
1839
|
+
* AccountAddress.from("0x1"),
|
|
1840
|
+
* AccountAddress.from("0x2"),
|
|
1841
|
+
* AccountAddress.from("0xa"),
|
|
1842
|
+
* AccountAddress.from("0xb"),
|
|
1843
|
+
* );
|
|
1844
|
+
* const serializer = new Serializer();
|
|
1845
|
+
* serializer.serializeVector(addresses);
|
|
1846
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1847
|
+
* // serializedBytes is now the BCS-serialized bytes
|
|
1848
|
+
* // The equivalent value in Move would be:
|
|
1849
|
+
* // `bcs::to_bytes(&vector<address> [@0x1, @0x2, @0xa, @0xb])`;
|
|
1850
|
+
*/
|
|
1851
|
+
serializeVector<T extends Serializable>(values: Array<T>): void;
|
|
1852
|
+
serializeOption<T extends Serializable>(value?: T): void;
|
|
1853
|
+
serializeOptionStr(value?: string): void;
|
|
1854
|
+
}
|
|
1855
|
+
declare function ensureBoolean(value: unknown): asserts value is boolean;
|
|
1856
|
+
declare const outOfRangeErrorMessage: (value: AnyNumber, min: AnyNumber, max: AnyNumber) => string;
|
|
1857
|
+
declare function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T, maxValue: T): void;
|
|
1858
|
+
|
|
1859
|
+
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
1860
|
+
}
|
|
1861
|
+
interface EntryFunctionArgument {
|
|
1862
|
+
/**
|
|
1863
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
1864
|
+
*/
|
|
1865
|
+
serialize(serializer: Serializer): void;
|
|
1866
|
+
/**
|
|
1867
|
+
* Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains
|
|
1868
|
+
* the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
|
|
1869
|
+
*/
|
|
1870
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
1871
|
+
bcsToBytes(): Uint8Array;
|
|
1872
|
+
bcsToHex(): Hex;
|
|
1873
|
+
}
|
|
1874
|
+
interface ScriptFunctionArgument {
|
|
1875
|
+
/**
|
|
1876
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
1877
|
+
*/
|
|
1878
|
+
serialize(serializer: Serializer): void;
|
|
1879
|
+
/**
|
|
1880
|
+
* Serialize an argument to BCS-serialized bytes as a type aware byte sequence.
|
|
1881
|
+
* The byte sequence contains an enum variant index followed by the BCS-serialized
|
|
1882
|
+
* bytes for a typed argument.
|
|
1883
|
+
*/
|
|
1884
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
1885
|
+
bcsToBytes(): Uint8Array;
|
|
1886
|
+
bcsToHex(): Hex;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* This enum is used to explain why an address was invalid.
|
|
1891
|
+
*/
|
|
1892
|
+
declare enum AddressInvalidReason {
|
|
1893
|
+
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
1894
|
+
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
1895
|
+
TOO_SHORT = "too_short",
|
|
1896
|
+
TOO_LONG = "too_long",
|
|
1897
|
+
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
1898
|
+
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
1899
|
+
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
1900
|
+
}
|
|
1901
|
+
type AccountAddressInput = HexInput | AccountAddress;
|
|
1902
|
+
/**
|
|
1903
|
+
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
1904
|
+
* hashes, use the Hex class.
|
|
1905
|
+
*
|
|
1906
|
+
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
1907
|
+
* represented as a string, generally look like these examples:
|
|
1908
|
+
* - 0x1
|
|
1909
|
+
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
1910
|
+
*
|
|
1911
|
+
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
1912
|
+
* To learn more about the standard, read the AIP here:
|
|
1913
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
1914
|
+
*
|
|
1915
|
+
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
1916
|
+
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
1917
|
+
*/
|
|
1918
|
+
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
1919
|
+
/**
|
|
1920
|
+
* This is the internal representation of an account address.
|
|
1921
|
+
*/
|
|
1922
|
+
readonly data: Uint8Array;
|
|
1923
|
+
/**
|
|
1924
|
+
* The number of bytes that make up an account address.
|
|
1925
|
+
*/
|
|
1926
|
+
static readonly LENGTH: number;
|
|
1927
|
+
/**
|
|
1928
|
+
* The length of an address string in LONG form without a leading 0x.
|
|
1929
|
+
*/
|
|
1930
|
+
static readonly LONG_STRING_LENGTH: number;
|
|
1931
|
+
static ZERO: AccountAddress;
|
|
1932
|
+
static ONE: AccountAddress;
|
|
1933
|
+
static TWO: AccountAddress;
|
|
1934
|
+
static THREE: AccountAddress;
|
|
1935
|
+
static FOUR: AccountAddress;
|
|
1936
|
+
/**
|
|
1937
|
+
* Creates an instance of AccountAddress from a Uint8Array.
|
|
1938
|
+
*
|
|
1939
|
+
* @param args.data A Uint8Array representing an account address.
|
|
1940
|
+
*/
|
|
1941
|
+
constructor(input: Uint8Array);
|
|
1942
|
+
/**
|
|
1943
|
+
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
1944
|
+
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
1945
|
+
* and every other byte must be zero.
|
|
1946
|
+
*
|
|
1947
|
+
* For more information on how special addresses are defined see AIP-40:
|
|
1948
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
1949
|
+
*
|
|
1950
|
+
* @returns true if the address is special, false if not.
|
|
1951
|
+
*/
|
|
1952
|
+
isSpecial(): boolean;
|
|
1953
|
+
/**
|
|
1954
|
+
* Return the AccountAddress as a string as per AIP-40.
|
|
1955
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
1956
|
+
*
|
|
1957
|
+
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
1958
|
+
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
1959
|
+
* meaning 0x + 64 hex characters.
|
|
1960
|
+
*
|
|
1961
|
+
* @returns AccountAddress as a string conforming to AIP-40.
|
|
1962
|
+
*/
|
|
1963
|
+
toString(): `0x${string}`;
|
|
1964
|
+
/**
|
|
1965
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
1966
|
+
*
|
|
1967
|
+
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
1968
|
+
*
|
|
1969
|
+
* Learn more by reading the docstring of `toString`.
|
|
1970
|
+
*
|
|
1971
|
+
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
1972
|
+
*/
|
|
1973
|
+
toStringWithoutPrefix(): string;
|
|
1974
|
+
/**
|
|
1975
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
1976
|
+
*
|
|
1977
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
1978
|
+
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
1979
|
+
* unconditionally.
|
|
1980
|
+
*
|
|
1981
|
+
* This means it will be 0x + 64 hex characters.
|
|
1982
|
+
*
|
|
1983
|
+
* @returns AccountAddress as a string in LONG form.
|
|
1984
|
+
*/
|
|
1985
|
+
toStringLong(): `0x${string}`;
|
|
1986
|
+
/**
|
|
1987
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
1988
|
+
*
|
|
1989
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
1990
|
+
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
1991
|
+
* will not have a leading zero.
|
|
1992
|
+
*
|
|
1993
|
+
* This means it will be 64 hex characters without a leading 0x.
|
|
1994
|
+
*
|
|
1995
|
+
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
1996
|
+
*/
|
|
1997
|
+
toStringLongWithoutPrefix(): string;
|
|
1998
|
+
/**
|
|
1999
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2000
|
+
* is taking place here, it just returns the inner data.
|
|
2001
|
+
*
|
|
2002
|
+
* @returns Hex data as Uint8Array
|
|
2003
|
+
*/
|
|
2004
|
+
toUint8Array(): Uint8Array;
|
|
2005
|
+
/**
|
|
2006
|
+
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2007
|
+
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2008
|
+
* @returns void
|
|
2009
|
+
* @example
|
|
2010
|
+
* const serializer = new Serializer();
|
|
2011
|
+
* const address = AccountAddress.fromString("0x1");
|
|
2012
|
+
* address.serialize(serializer);
|
|
2013
|
+
* const bytes = serializer.toUint8Array();
|
|
2014
|
+
* // `bytes` is now the BCS-serialized address.
|
|
2015
|
+
*/
|
|
2016
|
+
serialize(serializer: Serializer): void;
|
|
2017
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2018
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2019
|
+
/**
|
|
2020
|
+
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2021
|
+
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2022
|
+
* @returns An instance of AccountAddress.
|
|
2023
|
+
* @example
|
|
2024
|
+
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2025
|
+
* const deserializer = new Deserializer(bytes);
|
|
2026
|
+
* const address = AccountAddress.deserialize(deserializer);
|
|
2027
|
+
* // `address` is now an instance of AccountAddress.
|
|
2028
|
+
*/
|
|
2029
|
+
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2030
|
+
/**
|
|
2031
|
+
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2032
|
+
* the `fromString` function.
|
|
2033
|
+
*
|
|
2034
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2035
|
+
*
|
|
2036
|
+
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2037
|
+
* means only the following formats are accepted:
|
|
2038
|
+
*
|
|
2039
|
+
* - LONG
|
|
2040
|
+
* - SHORT for special addresses
|
|
2041
|
+
*
|
|
2042
|
+
* Where:
|
|
2043
|
+
* - LONG is defined as 0x + 64 hex characters.
|
|
2044
|
+
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2045
|
+
*
|
|
2046
|
+
* This means the following are not accepted:
|
|
2047
|
+
* - SHORT for non-special addresses.
|
|
2048
|
+
* - Any address without a leading 0x.
|
|
2049
|
+
*
|
|
2050
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2051
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2052
|
+
*
|
|
2053
|
+
* @param input A hex string representing an account address.
|
|
2054
|
+
*
|
|
2055
|
+
* @returns An instance of AccountAddress.
|
|
2056
|
+
*/
|
|
2057
|
+
static fromStringStrict(input: string): AccountAddress;
|
|
2058
|
+
/**
|
|
2059
|
+
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2060
|
+
* the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
|
|
2061
|
+
* function, `fromString` is only provided for backwards compatibility.
|
|
2062
|
+
*
|
|
2063
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2064
|
+
*
|
|
2065
|
+
* This function allows all formats defined by AIP-40. In short this means the
|
|
2066
|
+
* following formats are accepted:
|
|
2067
|
+
*
|
|
2068
|
+
* - LONG, with or without leading 0x
|
|
2069
|
+
* - SHORT, with or without leading 0x
|
|
2070
|
+
*
|
|
2071
|
+
* Where:
|
|
2072
|
+
* - LONG is 64 hex characters.
|
|
2073
|
+
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2074
|
+
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2075
|
+
*
|
|
2076
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2077
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2078
|
+
*
|
|
2079
|
+
* @param input A hex string representing an account address.
|
|
2080
|
+
*
|
|
2081
|
+
* @returns An instance of AccountAddress.
|
|
2082
|
+
*/
|
|
2083
|
+
static fromString(input: string): AccountAddress;
|
|
2084
|
+
/**
|
|
2085
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2086
|
+
*
|
|
2087
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2088
|
+
* @param input
|
|
2089
|
+
*/
|
|
2090
|
+
static from(input: AccountAddressInput): AccountAddress;
|
|
2091
|
+
/**
|
|
2092
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2093
|
+
*
|
|
2094
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2095
|
+
* @param input
|
|
2096
|
+
*/
|
|
2097
|
+
static fromStrict(input: AccountAddressInput): AccountAddress;
|
|
2098
|
+
/**
|
|
2099
|
+
* Check if the string is a valid AccountAddress.
|
|
2100
|
+
*
|
|
2101
|
+
* @param args.input A hex string representing an account address.
|
|
2102
|
+
* @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.
|
|
2103
|
+
*
|
|
2104
|
+
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2105
|
+
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2106
|
+
*/
|
|
2107
|
+
static isValid(args: {
|
|
2108
|
+
input: AccountAddressInput;
|
|
2109
|
+
strict?: boolean;
|
|
2110
|
+
}): ParsingResult<AddressInvalidReason>;
|
|
2111
|
+
/**
|
|
2112
|
+
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2113
|
+
* if their underlying byte data is identical.
|
|
2114
|
+
*
|
|
2115
|
+
* @param other The AccountAddress to compare to.
|
|
2116
|
+
* @returns true if the AccountAddresses are equal, false if not.
|
|
2117
|
+
*/
|
|
2118
|
+
equals(other: AccountAddress): boolean;
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
export { type MoveFunction as $, type AnyNumber as A, type GetAccountCoinsDataResponse as B, type Client as C, Deserializer as D, type EntryFunctionArgument as E, type FullNodeConfig as F, type GetAccountOwnedTokensQueryResponse as G, type HexInput as H, type IndexerConfig as I, type GetAccountOwnedObjectsResponse as J, type GetCollectionDataResponse as K, type LedgerVersionArg as L, type MoveModuleId as M, Network as N, type OrderByArg as O, type PaginationArgs as P, type GetTokenDataResponse as Q, type GetCurrentTokenOwnershipResponse as R, Serializable as S, type TransactionArgument as T, type Uint8 as U, type GetOwnedTokensResponse as V, type WhereArg as W, type GetTokenActivityResponse as X, type GetEventsResponse as Y, type WaitForTransactionOptions as Z, type UserTransactionResponse as _, Serializer as a, type MultisigPayloadResponse as a$, type GetFungibleAssetMetadataResponse as a0, type GetFungibleAssetActivitiesResponse as a1, type GetCurrentFungibleAssetBalancesResponse as a2, type LedgerInfo as a3, type Block as a4, type TableItemRequest as a5, type MoveValue as a6, type GetChainTopUserTransactionsResponse as a7, type GraphqlQuery as a8, type GetProcessorStatusResponse as a9, type Uint64 as aA, type Uint128 as aB, type Uint256 as aC, type ClientHeadersType as aD, TransactionResponseType as aE, isPendingTransactionResponse as aF, isUserTransactionResponse as aG, isGenesisTransactionResponse as aH, isBlockMetadataTransactionResponse as aI, isStateCheckpointTransactionResponse as aJ, isValidatorTransactionResponse as aK, type GenesisTransactionResponse as aL, type BlockMetadataTransactionResponse as aM, type StateCheckpointTransactionResponse as aN, type ValidatorTransactionResponse as aO, type WriteSetChange as aP, type WriteSetChangeDeleteModule as aQ, type WriteSetChangeDeleteResource as aR, type WriteSetChangeDeleteTableItem as aS, type WriteSetChangeWriteModule as aT, type WriteSetChangeWriteResource as aU, type WriteSetChangeWriteTableItem as aV, type DecodedTableData as aW, type DeletedTableData as aX, type TransactionPayloadResponse as aY, type EntryFunctionPayloadResponse as aZ, type ScriptPayloadResponse as a_, type GetANSNameResponse as aa, type GetNumberOfDelegatorsResponse as ab, type GetDelegatedStakingActivitiesResponse as ac, type PendingTransactionResponse as ad, type CommittedTransactionResponse as ae, type GasEstimation as af, type AptosRequest as ag, type ClientRequest as ah, type ClientResponse as ai, MimeType as aj, ensureBoolean as ak, outOfRangeErrorMessage as al, validateNumberInRange as am, AddressInvalidReason as an, ParsingError as ao, type ParsingResult as ap, HexInvalidReason as aq, TypeTagVariants as ar, ScriptTransactionArgumentVariants as as, TransactionPayloadVariants as at, TransactionVariants as au, TransactionAuthenticatorVariant as av, AccountAuthenticatorVariant as aw, AnySignatureVariant as ax, EphemeralSignatureVariant as ay, EphemeralCertificate as az, type Uint16 as b, type GenesisPayload as b0, type MoveScriptBytecode as b1, type TransactionSignature as b2, isEd25519Signature as b3, isSecp256k1Signature as b4, isMultiAgentSignature as b5, isFeePayerSignature as b6, isMultiEd25519Signature as b7, type TransactionEd25519Signature as b8, type TransactionSecp256k1Signature as b9, DeriveScheme as bA, type GenerateAccountWithEd25519 as bB, type GenerateAccountWithSingleSignerSecp256k1Key as bC, type GenerateAccount as bD, type OrderBy as bE, type OrderByValue as bF, type TokenStandard as bG, NetworkToIndexerAPI as bH, NetworkToNodeAPI as bI, NetworkToFaucetAPI as bJ, NetworkToPepperAPI as bK, NetworkToProverAPI as bL, NetworkToChainId as bM, NetworkToNetworkName as bN, type TransactionMultiEd25519Signature as ba, type TransactionMultiAgentSignature as bb, type TransactionFeePayerSignature as bc, type AccountSignature as bd, type WriteSet as be, type ScriptWriteSet as bf, type DirectWriteSet as bg, type EventGuid as bh, type Event as bi, type MoveUint8Type as bj, type MoveUint16Type as bk, type MoveUint32Type as bl, type MoveUint64Type as bm, type MoveUint128Type as bn, type MoveUint256Type as bo, type MoveAddressType as bp, type MoveObjectType as bq, type MoveOptionType as br, type MoveStructType as bs, type MoveType as bt, MoveFunctionVisibility as bu, MoveAbility as bv, type MoveStructField as bw, type MoveModule as bx, type MoveStruct as by, RoleType as bz, type Uint32 as c, type Deserializable as d, Hex as e, type AuthenticationKeyScheme as f, AccountAddress as g, AnyPublicKeyVariant as h, EphemeralPublicKeyVariant as i, type ClientConfig as j, type FaucetConfig as k, type AptosSettings as l, type ScriptFunctionArgument as m, type MoveFunctionId as n, type AccountAddressInput as o, type MoveFunctionGenericTypeParam as p, SigningSchemeInput as q, SigningScheme as r, type AccountData as s, type MoveModuleBytecode as t, type TransactionResponse as u, type MoveResource as v, type MoveStructId as w, type TokenStandardArg as x, type GetAccountOwnedTokensFromCollectionResponse as y, type GetAccountCollectionsWithOwnedTokenResponse as z };
|