@aptos-labs/ts-sdk 6.0.0 → 6.2.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/README.md +9 -13
- package/dist/common/{account-Dpz_N9h-.d.ts → account-DGpxrkAn.d.ts} +187 -20
- package/dist/common/chunk-2VR6ONNW.js +4 -0
- package/dist/common/chunk-2VR6ONNW.js.map +1 -0
- package/dist/common/cli/index.d.ts +2 -2
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +69 -6
- package/dist/common/index.js +34 -45
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-BW_kXHC2.d.mts → Ed25519Account-BCt2cu_M.d.mts} +2 -2
- package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.d.mts +2 -2
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.d.mts +3 -3
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
- package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +26 -2
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +3 -3
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +3 -3
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.d.mts +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/{account-CcxnCdYZ.d.mts → account-Dg0ejXHy.d.mts} +172 -8
- package/dist/esm/api/account/abstraction.d.mts +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -2
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +3 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +3 -3
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +3 -3
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- 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 +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/consts.d.mts +1 -1
- package/dist/esm/bcs/deserializer.d.mts +1 -1
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -1
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-5FNZUL2Y.mjs → chunk-2VBY2V4Z.mjs} +2 -2
- package/dist/esm/chunk-2VHA77EO.mjs +2 -0
- package/dist/esm/chunk-2VHA77EO.mjs.map +1 -0
- package/dist/esm/{chunk-35DKMW7Q.mjs → chunk-44MMFX5F.mjs} +1 -1
- package/dist/esm/chunk-44MMFX5F.mjs.map +1 -0
- package/dist/esm/chunk-5HHC2YG4.mjs +2 -0
- package/dist/esm/chunk-5LMLIRGK.mjs +2 -0
- package/dist/esm/chunk-5LMLIRGK.mjs.map +1 -0
- package/dist/esm/chunk-66F7RP7K.mjs +2 -0
- package/dist/esm/chunk-66F7RP7K.mjs.map +1 -0
- package/dist/esm/chunk-6CD6PDFJ.mjs +4 -0
- package/dist/esm/chunk-6CD6PDFJ.mjs.map +1 -0
- package/dist/esm/{chunk-FW6UHAQV.mjs → chunk-A7SQEK23.mjs} +2 -2
- package/dist/esm/chunk-A7SQEK23.mjs.map +1 -0
- package/dist/esm/{chunk-G3HAIETV.mjs → chunk-ASFFADWS.mjs} +2 -2
- package/dist/esm/chunk-ASFFADWS.mjs.map +1 -0
- package/dist/esm/chunk-AUGTNOKZ.mjs +2 -0
- package/dist/esm/{chunk-RQN6LA7E.mjs.map → chunk-AUGTNOKZ.mjs.map} +1 -1
- package/dist/esm/chunk-BT742BFQ.mjs +2 -0
- package/dist/esm/chunk-BT742BFQ.mjs.map +1 -0
- package/dist/esm/chunk-C2KVLMPH.mjs +2 -0
- package/dist/esm/chunk-C2KVLMPH.mjs.map +1 -0
- package/dist/esm/{chunk-DIFSO4N6.mjs → chunk-CD3EZCI5.mjs} +2 -2
- package/dist/esm/{chunk-43LWUUXS.mjs → chunk-E3DHFXN4.mjs} +2 -2
- package/dist/esm/{chunk-QDJDZ3ON.mjs → chunk-EIWPAECI.mjs} +2 -2
- package/dist/esm/{chunk-GOXRBEIJ.mjs → chunk-F45HI7LU.mjs} +1 -1
- package/dist/esm/chunk-F45HI7LU.mjs.map +1 -0
- package/dist/esm/chunk-F4LHBGG2.mjs +2 -0
- package/dist/esm/chunk-F4LHBGG2.mjs.map +1 -0
- package/dist/esm/{chunk-MEG27LEV.mjs → chunk-FDHHQUS3.mjs} +3 -3
- package/dist/esm/chunk-FDHHQUS3.mjs.map +1 -0
- package/dist/esm/{chunk-LS2HRAVW.mjs → chunk-G5OONGWS.mjs} +1 -12
- package/dist/esm/chunk-G5OONGWS.mjs.map +1 -0
- package/dist/esm/{chunk-F3NI6N7R.mjs → chunk-H2T2SU5O.mjs} +2 -2
- package/dist/esm/chunk-H2T2SU5O.mjs.map +1 -0
- package/dist/esm/chunk-ITZN23GU.mjs +2 -0
- package/dist/esm/{chunk-X674XJNJ.mjs → chunk-KOVWYU53.mjs} +2 -2
- package/dist/esm/{chunk-PXJEKGEG.mjs → chunk-LDK76MDN.mjs} +2 -2
- package/dist/esm/chunk-M65PXVDO.mjs +2 -0
- package/dist/esm/chunk-M65PXVDO.mjs.map +1 -0
- package/dist/esm/{chunk-WZ6FL7CH.mjs → chunk-NWP2VEMB.mjs} +2 -2
- package/dist/esm/chunk-ODNZJSOC.mjs +2 -0
- package/dist/esm/chunk-ODNZJSOC.mjs.map +1 -0
- package/dist/esm/{chunk-6IWGTO2J.mjs → chunk-POQ4FT4E.mjs} +2 -2
- package/dist/esm/{chunk-76SVQZDX.mjs → chunk-Q4KYBAYN.mjs} +2 -2
- package/dist/esm/chunk-Q5ESW36C.mjs +2 -0
- package/dist/esm/chunk-Q5ESW36C.mjs.map +1 -0
- package/dist/esm/{chunk-52PWWLJJ.mjs → chunk-QRW7MQDA.mjs} +2 -2
- package/dist/esm/chunk-QRW7MQDA.mjs.map +1 -0
- package/dist/esm/{chunk-3P474TWM.mjs → chunk-R7PCBRRT.mjs} +2 -2
- package/dist/esm/chunk-T32P4APJ.mjs +2 -0
- package/dist/esm/chunk-T32P4APJ.mjs.map +1 -0
- package/dist/esm/chunk-TAHLOBRG.mjs +2 -0
- package/dist/esm/chunk-TAHLOBRG.mjs.map +1 -0
- package/dist/esm/{chunk-RYOICF37.mjs → chunk-TSPG5VED.mjs} +2 -2
- package/dist/esm/{chunk-56IXVVXX.mjs → chunk-UPHD2B4I.mjs} +2 -2
- package/dist/esm/{chunk-QREVMGQZ.mjs → chunk-UVJW4DPP.mjs} +1 -1
- package/dist/esm/{chunk-QREVMGQZ.mjs.map → chunk-UVJW4DPP.mjs.map} +1 -1
- package/dist/esm/chunk-UYG4XVVO.mjs +2 -0
- package/dist/esm/chunk-UYG4XVVO.mjs.map +1 -0
- package/dist/esm/chunk-WFZFTRRS.mjs +2 -0
- package/dist/esm/chunk-WFZFTRRS.mjs.map +1 -0
- package/dist/esm/{chunk-CUXCVNES.mjs → chunk-X4IR6WX6.mjs} +2 -2
- package/dist/esm/chunk-YJVBGKWM.mjs +2 -0
- package/dist/esm/chunk-YJVBGKWM.mjs.map +1 -0
- package/dist/esm/{chunk-NTLOKAPD.mjs → chunk-YTFJ5W7U.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.d.mts +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.d.mts +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.d.mts +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -1
- package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +2 -2
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/secp256r1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256r1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/types.d.mts +1 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +1 -1
- package/dist/esm/core/index.d.mts +2 -2
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/{federatedKeyless-BzaYmP03.d.mts → federatedKeyless-BYLu31Sa.d.mts} +13 -2
- package/dist/esm/index.d.mts +5 -5
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.d.mts +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/account.d.mts +3 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +3 -3
- package/dist/esm/internal/digitalAsset.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 +4 -4
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +4 -2
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +3 -3
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +2 -2
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/utils/index.d.mts +1 -1
- package/dist/esm/internal/utils/index.mjs +1 -1
- package/dist/esm/internal/utils/utils.d.mts +1 -1
- package/dist/esm/internal/utils/utils.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +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.d.mts +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +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 +2 -2
- 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 +12 -4
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +1 -1
- package/dist/esm/types/generated/operations.d.mts +0 -11
- package/dist/esm/types/generated/queries.d.mts +1 -1
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +1 -1
- package/dist/esm/types/types.d.mts +1 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/utils/const.d.mts +16 -2
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +21 -2
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +3 -3
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/memoize.d.mts +23 -1
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +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 +36 -50
- package/src/account/AbstractKeylessAccount.ts +2 -3
- package/src/account/DerivableAbstractedAccount.ts +1 -3
- package/src/account/EphemeralKeyPair.ts +53 -2
- package/src/account/MultiEd25519Account.ts +0 -2
- package/src/account/MultiKeyAccount.ts +0 -2
- package/src/account/SingleKeyAccount.ts +0 -1
- package/src/api/account.ts +1 -2
- package/src/api/ans.ts +0 -1
- package/src/api/aptos.ts +1 -1
- package/src/api/aptosConfig.ts +12 -1
- package/src/api/transaction.ts +4 -4
- package/src/api/transactionSubmission/build.ts +1 -5
- package/src/api/transactionSubmission/helpers.ts +0 -1
- package/src/api/transactionSubmission/sign.ts +2 -2
- package/src/bcs/deserializer.ts +64 -17
- package/src/bcs/serializable/movePrimitives.ts +15 -28
- package/src/bcs/serializable/moveStructs.ts +4 -6
- package/src/bcs/serializer.ts +147 -12
- package/src/cli/localNode.ts +4 -7
- package/src/cli/move.ts +7 -7
- package/src/client/get.ts +8 -10
- package/src/core/account/utils/address.ts +3 -3
- package/src/core/accountAddress.ts +2 -3
- package/src/core/crypto/abstraction.ts +0 -3
- package/src/core/crypto/ed25519.ts +66 -1
- package/src/core/crypto/federatedKeyless.ts +1 -1
- package/src/core/crypto/keyless.ts +65 -14
- package/src/core/crypto/multiEd25519.ts +1 -3
- package/src/core/crypto/multiKey.ts +4 -7
- package/src/core/crypto/poseidon.ts +0 -1
- package/src/core/crypto/privateKey.ts +2 -5
- package/src/core/crypto/secp256k1.ts +68 -3
- package/src/core/crypto/secp256r1.ts +1 -1
- package/src/core/crypto/singleKey.ts +4 -1
- package/src/core/crypto/utils.ts +6 -3
- package/src/errors/index.ts +4 -5
- package/src/internal/account.ts +21 -30
- package/src/internal/ans.ts +5 -6
- package/src/internal/general.ts +24 -6
- package/src/internal/keyless.ts +1 -1
- package/src/internal/queries/getAccountAddressesForAuthKey.graphql +4 -1
- package/src/internal/queries/getAuthKeysForPublicKey.graphql +4 -1
- package/src/internal/queries/getCollectionData.graphql +0 -11
- package/src/internal/queries/getTableItemsData.graphql +1 -1
- package/src/internal/queries/getTableItemsMetadata.graphql +2 -2
- package/src/internal/transaction.ts +5 -7
- package/src/internal/transactionSubmission.ts +23 -0
- package/src/transactions/authenticator/account.ts +0 -4
- package/src/transactions/authenticator/transaction.ts +0 -2
- package/src/transactions/instances/multiAgentTransaction.ts +0 -2
- package/src/transactions/instances/rawTransaction.ts +0 -2
- package/src/transactions/instances/signedTransaction.ts +0 -2
- package/src/transactions/instances/simpleTransaction.ts +0 -2
- package/src/transactions/instances/transactionPayload.ts +5 -7
- package/src/transactions/management/accountSequenceNumber.ts +0 -4
- package/src/transactions/management/transactionWorker.ts +40 -10
- package/src/transactions/transactionBuilder/remoteAbi.ts +22 -8
- package/src/transactions/transactionBuilder/transactionBuilder.ts +14 -12
- package/src/transactions/typeTag/index.ts +0 -3
- package/src/transactions/typeTag/parser.ts +3 -5
- package/src/types/generated/operations.ts +0 -11
- package/src/types/generated/queries.ts +0 -11
- package/src/types/types.ts +26 -0
- package/src/utils/const.ts +17 -1
- package/src/utils/helpers.ts +47 -8
- package/src/utils/memoize.ts +177 -11
- package/src/version.ts +1 -1
- package/dist/common/chunk-4RHBBU7C.js +0 -4
- package/dist/common/chunk-4RHBBU7C.js.map +0 -1
- package/dist/esm/chunk-2DPQMXUG.mjs +0 -4
- package/dist/esm/chunk-2DPQMXUG.mjs.map +0 -1
- package/dist/esm/chunk-2LCPW76G.mjs +0 -2
- package/dist/esm/chunk-2LCPW76G.mjs.map +0 -1
- package/dist/esm/chunk-2PASUPUO.mjs +0 -2
- package/dist/esm/chunk-2PASUPUO.mjs.map +0 -1
- package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
- package/dist/esm/chunk-52PWWLJJ.mjs.map +0 -1
- package/dist/esm/chunk-54C2P534.mjs +0 -2
- package/dist/esm/chunk-54C2P534.mjs.map +0 -1
- package/dist/esm/chunk-BGZDJ5SM.mjs +0 -2
- package/dist/esm/chunk-BGZDJ5SM.mjs.map +0 -1
- package/dist/esm/chunk-C5UZZHA4.mjs +0 -2
- package/dist/esm/chunk-C5UZZHA4.mjs.map +0 -1
- package/dist/esm/chunk-F3NI6N7R.mjs.map +0 -1
- package/dist/esm/chunk-FW6UHAQV.mjs.map +0 -1
- package/dist/esm/chunk-G3HAIETV.mjs.map +0 -1
- package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
- package/dist/esm/chunk-I42Z32Q2.mjs +0 -2
- package/dist/esm/chunk-I42Z32Q2.mjs.map +0 -1
- package/dist/esm/chunk-JN65XG2P.mjs +0 -2
- package/dist/esm/chunk-JN65XG2P.mjs.map +0 -1
- package/dist/esm/chunk-KUF4DKN5.mjs +0 -2
- package/dist/esm/chunk-LD3I4CYO.mjs +0 -2
- package/dist/esm/chunk-LS2HRAVW.mjs.map +0 -1
- package/dist/esm/chunk-MEG27LEV.mjs.map +0 -1
- package/dist/esm/chunk-NCKJ7X57.mjs +0 -2
- package/dist/esm/chunk-NCKJ7X57.mjs.map +0 -1
- package/dist/esm/chunk-NK3Y3PV3.mjs +0 -2
- package/dist/esm/chunk-NK3Y3PV3.mjs.map +0 -1
- package/dist/esm/chunk-OLILO7VD.mjs +0 -2
- package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
- package/dist/esm/chunk-PYVKCTUN.mjs +0 -2
- package/dist/esm/chunk-PYVKCTUN.mjs.map +0 -1
- package/dist/esm/chunk-QEHKRR3I.mjs +0 -2
- package/dist/esm/chunk-QEHKRR3I.mjs.map +0 -1
- package/dist/esm/chunk-RQN6LA7E.mjs +0 -2
- package/dist/esm/chunk-Y426VCPM.mjs +0 -2
- package/dist/esm/chunk-Y426VCPM.mjs.map +0 -1
- package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
- package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
- /package/dist/esm/{chunk-5FNZUL2Y.mjs.map → chunk-2VBY2V4Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-KUF4DKN5.mjs.map → chunk-5HHC2YG4.mjs.map} +0 -0
- /package/dist/esm/{chunk-DIFSO4N6.mjs.map → chunk-CD3EZCI5.mjs.map} +0 -0
- /package/dist/esm/{chunk-43LWUUXS.mjs.map → chunk-E3DHFXN4.mjs.map} +0 -0
- /package/dist/esm/{chunk-QDJDZ3ON.mjs.map → chunk-EIWPAECI.mjs.map} +0 -0
- /package/dist/esm/{chunk-LD3I4CYO.mjs.map → chunk-ITZN23GU.mjs.map} +0 -0
- /package/dist/esm/{chunk-X674XJNJ.mjs.map → chunk-KOVWYU53.mjs.map} +0 -0
- /package/dist/esm/{chunk-PXJEKGEG.mjs.map → chunk-LDK76MDN.mjs.map} +0 -0
- /package/dist/esm/{chunk-WZ6FL7CH.mjs.map → chunk-NWP2VEMB.mjs.map} +0 -0
- /package/dist/esm/{chunk-6IWGTO2J.mjs.map → chunk-POQ4FT4E.mjs.map} +0 -0
- /package/dist/esm/{chunk-76SVQZDX.mjs.map → chunk-Q4KYBAYN.mjs.map} +0 -0
- /package/dist/esm/{chunk-3P474TWM.mjs.map → chunk-R7PCBRRT.mjs.map} +0 -0
- /package/dist/esm/{chunk-RYOICF37.mjs.map → chunk-TSPG5VED.mjs.map} +0 -0
- /package/dist/esm/{chunk-56IXVVXX.mjs.map → chunk-UPHD2B4I.mjs.map} +0 -0
- /package/dist/esm/{chunk-CUXCVNES.mjs.map → chunk-X4IR6WX6.mjs.map} +0 -0
- /package/dist/esm/{chunk-NTLOKAPD.mjs.map → chunk-YTFJ5W7U.mjs.map} +0 -0
|
@@ -76,8 +76,9 @@ import {
|
|
|
76
76
|
isBcsI256,
|
|
77
77
|
} from "./helpers";
|
|
78
78
|
import { MoveFunction, MoveModule } from "../../types";
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
import { warnIfDevelopment } from "../../utils/helpers";
|
|
80
|
+
import { memoizeAsync } from "../../utils/memoize";
|
|
81
|
+
import { TEXT_ENCODER } from "../../utils";
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* Convert type arguments to only type tags, allowing for string representations of type tags.
|
|
@@ -99,8 +100,15 @@ export function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<
|
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Cache TTL for module ABIs in milliseconds (5 minutes).
|
|
105
|
+
* ABIs rarely change, so a longer cache is acceptable.
|
|
106
|
+
*/
|
|
107
|
+
const MODULE_ABI_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
108
|
+
|
|
102
109
|
/**
|
|
103
110
|
* Fetches the ABI of a specified module from the on-chain module ABI.
|
|
111
|
+
* Results are cached for 5 minutes to reduce redundant network calls.
|
|
104
112
|
*
|
|
105
113
|
* @param moduleAddress - The address of the module from which to fetch the ABI.
|
|
106
114
|
* @param moduleName - The name of the module containing the ABI.
|
|
@@ -113,8 +121,16 @@ export async function fetchModuleAbi(
|
|
|
113
121
|
moduleName: string,
|
|
114
122
|
aptosConfig: AptosConfig,
|
|
115
123
|
): Promise<MoveModule | undefined> {
|
|
116
|
-
const
|
|
117
|
-
|
|
124
|
+
const cacheKey = `module-abi-${aptosConfig.network}-${moduleAddress}-${moduleName}`;
|
|
125
|
+
|
|
126
|
+
return memoizeAsync(
|
|
127
|
+
async () => {
|
|
128
|
+
const moduleBytecode = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });
|
|
129
|
+
return moduleBytecode.abi;
|
|
130
|
+
},
|
|
131
|
+
cacheKey,
|
|
132
|
+
MODULE_ABI_CACHE_TTL_MS,
|
|
133
|
+
)();
|
|
118
134
|
}
|
|
119
135
|
|
|
120
136
|
/**
|
|
@@ -628,10 +644,8 @@ function parseArg(
|
|
|
628
644
|
}
|
|
629
645
|
|
|
630
646
|
if (arg instanceof Uint8Array && options?.allowUnknownStructs) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
// eslint-disable-next-line max-len
|
|
634
|
-
`Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`,
|
|
647
|
+
warnIfDevelopment(
|
|
648
|
+
`[Aptos SDK] Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`,
|
|
635
649
|
);
|
|
636
650
|
return new FixedBytes(arg);
|
|
637
651
|
}
|
|
@@ -24,6 +24,7 @@ import { getInfo } from "../../internal/utils";
|
|
|
24
24
|
import { getLedgerInfo } from "../../internal/general";
|
|
25
25
|
import { getGasPriceEstimation } from "../../internal/transaction";
|
|
26
26
|
import { NetworkToChainId } from "../../utils/apiEndpoints";
|
|
27
|
+
import { MIN_MAX_GAS_AMOUNT } from "../../utils/const";
|
|
27
28
|
import { normalizeBundle } from "../../utils/normalizeBundle";
|
|
28
29
|
import {
|
|
29
30
|
AccountAuthenticator,
|
|
@@ -222,7 +223,6 @@ export function generateTransactionPayloadWithABI(
|
|
|
222
223
|
// Check that all arguments are accounted for
|
|
223
224
|
if ((functionArguments?.length ?? 0) !== functionAbi.parameters.length) {
|
|
224
225
|
throw new Error(
|
|
225
|
-
// eslint-disable-next-line max-len
|
|
226
226
|
`Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments?.length ?? 0}`,
|
|
227
227
|
);
|
|
228
228
|
}
|
|
@@ -314,7 +314,6 @@ export function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWi
|
|
|
314
314
|
// Check that all arguments are accounted for
|
|
315
315
|
if (functionArguments.length !== functionAbi.parameters.length) {
|
|
316
316
|
throw new Error(
|
|
317
|
-
// eslint-disable-next-line max-len
|
|
318
317
|
`Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,
|
|
319
318
|
);
|
|
320
319
|
}
|
|
@@ -392,7 +391,8 @@ export async function generateRawTransaction(args: {
|
|
|
392
391
|
const getSequenceNumber = async () => {
|
|
393
392
|
if (options?.accountSequenceNumber !== undefined) {
|
|
394
393
|
return options.accountSequenceNumber;
|
|
395
|
-
}
|
|
394
|
+
}
|
|
395
|
+
if (options?.replayProtectionNonce !== undefined) {
|
|
396
396
|
// If replay nonce is provided, use it as the sequence number
|
|
397
397
|
// This is an unused value, so it's specifically to show that the sequence number is not used
|
|
398
398
|
return 0xdeadbeefn;
|
|
@@ -413,7 +413,7 @@ export async function generateRawTransaction(args: {
|
|
|
413
413
|
try {
|
|
414
414
|
// Check if main signer has been created on chain, if not assign sequence number 0
|
|
415
415
|
return await getSequenceNumber();
|
|
416
|
-
} catch
|
|
416
|
+
} catch {
|
|
417
417
|
return 0;
|
|
418
418
|
}
|
|
419
419
|
} else {
|
|
@@ -426,8 +426,11 @@ export async function generateRawTransaction(args: {
|
|
|
426
426
|
getSequenceNumberForAny(),
|
|
427
427
|
]);
|
|
428
428
|
|
|
429
|
+
const userMaxGas = options?.maxGasAmount
|
|
430
|
+
? BigInt(options.maxGasAmount)
|
|
431
|
+
: BigInt(aptosConfig.getDefaultMaxGasAmount());
|
|
429
432
|
const { maxGasAmount, gasUnitPrice, expireTimestamp, replayProtectionNonce } = {
|
|
430
|
-
maxGasAmount:
|
|
433
|
+
maxGasAmount: userMaxGas < BigInt(MIN_MAX_GAS_AMOUNT) ? BigInt(MIN_MAX_GAS_AMOUNT) : userMaxGas,
|
|
431
434
|
gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),
|
|
432
435
|
expireTimestamp:
|
|
433
436
|
options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + aptosConfig.getDefaultTxnExpirySecFromNow()),
|
|
@@ -460,12 +463,14 @@ export function convertPayloadToInnerPayload(
|
|
|
460
463
|
new TransactionExecutableScript(payload.script),
|
|
461
464
|
new TransactionExtraConfigV1(undefined, replayProtectionNonce),
|
|
462
465
|
);
|
|
463
|
-
}
|
|
466
|
+
}
|
|
467
|
+
if (payload instanceof TransactionPayloadEntryFunction) {
|
|
464
468
|
return new TransactionInnerPayloadV1(
|
|
465
469
|
new TransactionExecutableEntryFunction(payload.entryFunction),
|
|
466
470
|
new TransactionExtraConfigV1(undefined, replayProtectionNonce),
|
|
467
471
|
);
|
|
468
|
-
}
|
|
472
|
+
}
|
|
473
|
+
if (payload instanceof TransactionPayloadMultiSig) {
|
|
469
474
|
const innerPayload = payload.multiSig.transaction_payload;
|
|
470
475
|
let executable: TransactionExecutable;
|
|
471
476
|
if (innerPayload === undefined || innerPayload?.transaction_payload === undefined) {
|
|
@@ -481,9 +486,8 @@ export function convertPayloadToInnerPayload(
|
|
|
481
486
|
executable,
|
|
482
487
|
new TransactionExtraConfigV1(payload.multiSig.multisig_address, replayProtectionNonce),
|
|
483
488
|
);
|
|
484
|
-
} else {
|
|
485
|
-
throw new Error(`Unsupported payload type: ${payload}`);
|
|
486
489
|
}
|
|
490
|
+
throw new Error(`Unsupported payload type: ${payload}`);
|
|
487
491
|
}
|
|
488
492
|
|
|
489
493
|
/**
|
|
@@ -704,9 +708,7 @@ export function getAuthenticatorForSimulation(publicKey?: PublicKey) {
|
|
|
704
708
|
return new AnySignature(invalidSignature);
|
|
705
709
|
}),
|
|
706
710
|
bitmap: accountPublicKey.createBitmap({
|
|
707
|
-
bits: Array(accountPublicKey.publicKeys.length)
|
|
708
|
-
.fill(0)
|
|
709
|
-
.map((_, i) => i),
|
|
711
|
+
bits: new Array(accountPublicKey.publicKeys.length).fill(0).map((_, i) => i),
|
|
710
712
|
}),
|
|
711
713
|
}),
|
|
712
714
|
);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
-
/* eslint-disable class-methods-use-this */
|
|
6
|
-
/* eslint-disable max-classes-per-file */
|
|
7
4
|
import { Deserializer } from "../../bcs/deserializer";
|
|
8
5
|
import { Serializable, Serializer } from "../../bcs/serializer";
|
|
9
6
|
import { AccountAddress } from "../../core";
|
|
@@ -299,7 +299,6 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
|
|
|
299
299
|
throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
// eslint-disable-next-line no-continue
|
|
303
302
|
continue;
|
|
304
303
|
} else {
|
|
305
304
|
// Any other characters just append to the current string
|
|
@@ -383,7 +382,7 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
383
382
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedVectorTypeArgumentCount);
|
|
384
383
|
}
|
|
385
384
|
return new TypeTagVector(types[0]);
|
|
386
|
-
default:
|
|
385
|
+
default: {
|
|
387
386
|
// Reference will have to handle the inner type
|
|
388
387
|
if (isRef(trimmedStr)) {
|
|
389
388
|
const actualType = trimmedStr.substring(1);
|
|
@@ -404,18 +403,16 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
404
403
|
}
|
|
405
404
|
|
|
406
405
|
// Parse for a struct tag
|
|
407
|
-
// eslint-disable-next-line no-case-declarations
|
|
408
406
|
const structParts = trimmedStr.split("::");
|
|
409
407
|
if (structParts.length !== 3) {
|
|
410
408
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);
|
|
411
409
|
}
|
|
412
410
|
|
|
413
411
|
// Validate struct address
|
|
414
|
-
// eslint-disable-next-line no-case-declarations
|
|
415
412
|
let address: AccountAddress;
|
|
416
413
|
try {
|
|
417
414
|
address = AccountAddress.fromString(structParts[0]);
|
|
418
|
-
} catch
|
|
415
|
+
} catch {
|
|
419
416
|
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);
|
|
420
417
|
}
|
|
421
418
|
|
|
@@ -430,5 +427,6 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
430
427
|
return new TypeTagStruct(
|
|
431
428
|
new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),
|
|
432
429
|
);
|
|
430
|
+
}
|
|
433
431
|
}
|
|
434
432
|
}
|
|
@@ -403,17 +403,6 @@ export type GetCollectionDataQuery = {
|
|
|
403
403
|
description: string;
|
|
404
404
|
last_transaction_timestamp: any;
|
|
405
405
|
last_transaction_version: any;
|
|
406
|
-
cdn_asset_uris?: {
|
|
407
|
-
cdn_image_uri?: string | null;
|
|
408
|
-
asset_uri: string;
|
|
409
|
-
animation_optimizer_retry_count: number;
|
|
410
|
-
cdn_animation_uri?: string | null;
|
|
411
|
-
cdn_json_uri?: string | null;
|
|
412
|
-
image_optimizer_retry_count: number;
|
|
413
|
-
json_parser_retry_count: number;
|
|
414
|
-
raw_animation_uri?: string | null;
|
|
415
|
-
raw_image_uri?: string | null;
|
|
416
|
-
} | null;
|
|
417
406
|
}>;
|
|
418
407
|
};
|
|
419
408
|
|
|
@@ -267,17 +267,6 @@ export const GetCollectionData = `
|
|
|
267
267
|
description
|
|
268
268
|
last_transaction_timestamp
|
|
269
269
|
last_transaction_version
|
|
270
|
-
cdn_asset_uris {
|
|
271
|
-
cdn_image_uri
|
|
272
|
-
asset_uri
|
|
273
|
-
animation_optimizer_retry_count
|
|
274
|
-
cdn_animation_uri
|
|
275
|
-
cdn_json_uri
|
|
276
|
-
image_optimizer_retry_count
|
|
277
|
-
json_parser_retry_count
|
|
278
|
-
raw_animation_uri
|
|
279
|
-
raw_image_uri
|
|
280
|
-
}
|
|
281
270
|
}
|
|
282
271
|
}
|
|
283
272
|
`;
|
package/src/types/types.ts
CHANGED
|
@@ -172,6 +172,11 @@ export enum AnyPublicKeyVariant {
|
|
|
172
172
|
Secp256r1 = 2,
|
|
173
173
|
Keyless = 3,
|
|
174
174
|
FederatedKeyless = 4,
|
|
175
|
+
/**
|
|
176
|
+
* Post-quantum signature scheme (SLH-DSA-SHA2-128s).
|
|
177
|
+
* Note: Full implementation not yet available in this SDK.
|
|
178
|
+
*/
|
|
179
|
+
SlhDsaSha2_128s = 5,
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
export function anyPublicKeyVariantToString(variant: AnyPublicKeyVariant): string {
|
|
@@ -186,6 +191,8 @@ export function anyPublicKeyVariantToString(variant: AnyPublicKeyVariant): strin
|
|
|
186
191
|
return "keyless";
|
|
187
192
|
case AnyPublicKeyVariant.FederatedKeyless:
|
|
188
193
|
return "federated_keyless";
|
|
194
|
+
case AnyPublicKeyVariant.SlhDsaSha2_128s:
|
|
195
|
+
return "slh_dsa_sha2_128s";
|
|
189
196
|
default:
|
|
190
197
|
throw new Error("Unknown public key variant");
|
|
191
198
|
}
|
|
@@ -199,6 +206,11 @@ export enum AnySignatureVariant {
|
|
|
199
206
|
Secp256k1 = 1,
|
|
200
207
|
WebAuthn = 2,
|
|
201
208
|
Keyless = 3,
|
|
209
|
+
/**
|
|
210
|
+
* Post-quantum signature scheme (SLH-DSA-SHA2-128s).
|
|
211
|
+
* Note: Full implementation not yet available in this SDK.
|
|
212
|
+
*/
|
|
213
|
+
SlhDsaSha2_128s = 4,
|
|
202
214
|
}
|
|
203
215
|
|
|
204
216
|
/**
|
|
@@ -368,6 +380,20 @@ export interface WhereArg<T extends {}> {
|
|
|
368
380
|
|
|
369
381
|
/**
|
|
370
382
|
* A configuration object for requests to the server, including API key, extra headers, and cookie handling options.
|
|
383
|
+
*
|
|
384
|
+
* Security Note: Consider implementing client-side rate limiting in your application to prevent
|
|
385
|
+
* accidental API abuse. You can use libraries like 'bottleneck' or 'p-queue' to limit request rates.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* import Bottleneck from 'bottleneck';
|
|
390
|
+
*
|
|
391
|
+
* // Create a limiter that allows 10 requests per second
|
|
392
|
+
* const limiter = new Bottleneck({ minTime: 100, maxConcurrent: 5 });
|
|
393
|
+
*
|
|
394
|
+
* // Wrap your Aptos calls with the limiter
|
|
395
|
+
* const result = await limiter.schedule(() => aptos.getAccountInfo({ accountAddress }));
|
|
396
|
+
* ```
|
|
371
397
|
*/
|
|
372
398
|
export type ClientConfig = ClientHeadersType & {
|
|
373
399
|
WITH_CREDENTIALS?: boolean;
|
package/src/utils/const.ts
CHANGED
|
@@ -24,7 +24,18 @@ export enum AptosApiType {
|
|
|
24
24
|
* @group Implementation
|
|
25
25
|
* @category Utils
|
|
26
26
|
*/
|
|
27
|
-
export const DEFAULT_MAX_GAS_AMOUNT =
|
|
27
|
+
export const DEFAULT_MAX_GAS_AMOUNT = 2000000;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The minimum max gas amount that the SDK will allow for a transaction.
|
|
31
|
+
*
|
|
32
|
+
* This value acts as a floor to prevent transactions from being built with a max gas amount
|
|
33
|
+
* below the network's minimum transaction gas units, which would cause
|
|
34
|
+
* MAX_GAS_UNITS_BELOW_MIN_TRANSACTION_GAS_UNITS errors.
|
|
35
|
+
* @group Implementation
|
|
36
|
+
* @category Utils
|
|
37
|
+
*/
|
|
38
|
+
export const MIN_MAX_GAS_AMOUNT = 2000;
|
|
28
39
|
|
|
29
40
|
/**
|
|
30
41
|
* The default transaction expiration seconds from now.
|
|
@@ -98,3 +109,8 @@ export enum ProcessorType {
|
|
|
98
109
|
* where project-id can contain letters, numbers, hyphens, and underscores
|
|
99
110
|
*/
|
|
100
111
|
export const FIREBASE_AUTH_ISS_PATTERN = /^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Shared TextEncoder instance for string serialization to avoid repeated instantiation.
|
|
115
|
+
*/
|
|
116
|
+
export const TEXT_ENCODER = new TextEncoder();
|
package/src/utils/helpers.ts
CHANGED
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { decode } from "js-base64";
|
|
4
|
+
import { Base64, decode } from "js-base64";
|
|
5
5
|
import { MoveFunctionId, MoveStructId } from "../types";
|
|
6
6
|
import { AccountAddress } from "../core/accountAddress";
|
|
7
7
|
import { createObjectAddress } from "../core/account/utils/address";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the current runtime environment is Bun.
|
|
11
|
+
* This is useful for detecting Bun-specific compatibility issues.
|
|
12
|
+
*
|
|
13
|
+
* @returns true if running in Bun, false otherwise.
|
|
14
|
+
* @group Implementation
|
|
15
|
+
* @category Utils
|
|
16
|
+
*/
|
|
17
|
+
export function isBun(): boolean {
|
|
18
|
+
try {
|
|
19
|
+
// Bun exposes a global `Bun` object.
|
|
20
|
+
return typeof globalThis !== "undefined" && "Bun" in globalThis;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Logs a warning message to the console only in development environments.
|
|
28
|
+
* This function helps reduce information leakage in production while maintaining
|
|
29
|
+
* helpful warnings during development.
|
|
30
|
+
*
|
|
31
|
+
* @param message - The warning message to log.
|
|
32
|
+
* @group Implementation
|
|
33
|
+
* @category Utils
|
|
34
|
+
*/
|
|
35
|
+
export function warnIfDevelopment(message: string): void {
|
|
36
|
+
// Check common environment variables to determine if we're in development
|
|
37
|
+
// This works in Node.js, bundlers like webpack/vite, and most build systems
|
|
38
|
+
const isDevelopment =
|
|
39
|
+
typeof process !== "undefined" &&
|
|
40
|
+
process.env &&
|
|
41
|
+
(process.env.NODE_ENV === "development" ||
|
|
42
|
+
process.env.NODE_ENV === "test" ||
|
|
43
|
+
process.env.APTOS_SDK_WARNINGS === "true");
|
|
44
|
+
|
|
45
|
+
if (isDevelopment) {
|
|
46
|
+
console.warn(message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
9
50
|
/**
|
|
10
51
|
* Sleep for the specified amount of time in milliseconds.
|
|
11
52
|
* This function can be used to introduce delays in asynchronous operations.
|
|
@@ -80,8 +121,8 @@ export function base64UrlToBytes(base64Url: string): Uint8Array {
|
|
|
80
121
|
while (base64.length % 4 !== 0) {
|
|
81
122
|
base64 += "=";
|
|
82
123
|
}
|
|
83
|
-
// Use
|
|
84
|
-
return
|
|
124
|
+
// Use js-base64 to convert base64 to Uint8Array
|
|
125
|
+
return Base64.toUint8Array(base64);
|
|
85
126
|
}
|
|
86
127
|
|
|
87
128
|
/**
|
|
@@ -154,7 +195,6 @@ export const parseEncodedStruct = (structObj: {
|
|
|
154
195
|
module_name: string;
|
|
155
196
|
struct_name: string;
|
|
156
197
|
}): MoveStructId => {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
158
198
|
const { account_address, module_name, struct_name } = structObj;
|
|
159
199
|
const moduleName = hexToAscii(module_name);
|
|
160
200
|
const structName = hexToAscii(struct_name);
|
|
@@ -241,7 +281,6 @@ export function truncateAddress(address: string, start: number = 6, end: number
|
|
|
241
281
|
* Constants for metadata address calculation
|
|
242
282
|
*/
|
|
243
283
|
const APTOS_COIN_TYPE_STR = "0x1::aptos_coin::AptosCoin";
|
|
244
|
-
const APT_METADATA_ADDRESS_HEX = AccountAddress.A.toStringLong();
|
|
245
284
|
|
|
246
285
|
/**
|
|
247
286
|
* Helper function to standardize Move type string by converting all addresses to short form,
|
|
@@ -252,10 +291,10 @@ function standardizeMoveTypeString(input: string): string {
|
|
|
252
291
|
// This regex matches "0x" followed by hex digits, handling both standalone addresses and those within <>
|
|
253
292
|
const addressRegex = /0x[0-9a-fA-F]+/g;
|
|
254
293
|
|
|
255
|
-
return input.replace(addressRegex, (match) =>
|
|
294
|
+
return input.replace(addressRegex, (match) =>
|
|
256
295
|
// Use AccountAddress to handle the address
|
|
257
|
-
|
|
258
|
-
|
|
296
|
+
AccountAddress.from(match, { maxMissingChars: 63 }).toStringShort(),
|
|
297
|
+
);
|
|
259
298
|
}
|
|
260
299
|
|
|
261
300
|
/**
|
package/src/utils/memoize.ts
CHANGED
|
@@ -2,18 +2,130 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Maximum number of entries to keep in the cache to prevent unbounded memory growth.
|
|
6
|
+
* When this limit is exceeded, the oldest entries are evicted.
|
|
7
|
+
*/
|
|
8
|
+
const MAX_CACHE_SIZE = 1000;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Interval in milliseconds for periodic cleanup of expired cache entries.
|
|
12
|
+
*/
|
|
13
|
+
const CLEANUP_INTERVAL_MS = 60000; // 1 minute
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Minimum required key length to help ensure uniqueness.
|
|
17
|
+
* Keys should include a namespace prefix (e.g., "module-abi-", "ledger-info-").
|
|
18
|
+
*/
|
|
19
|
+
const MIN_KEY_LENGTH = 10;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Set of known cache key prefixes to help detect potential collisions.
|
|
23
|
+
* Each caller should use a unique prefix.
|
|
24
|
+
*/
|
|
25
|
+
const knownKeyPrefixes = new Set<string>();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Validates a cache key for basic security requirements.
|
|
29
|
+
* @param key - The cache key to validate
|
|
30
|
+
* @throws Error if the key is invalid
|
|
31
|
+
*/
|
|
32
|
+
function validateCacheKey(key: string): void {
|
|
33
|
+
if (!key || typeof key !== "string") {
|
|
34
|
+
throw new Error("Cache key must be a non-empty string");
|
|
35
|
+
}
|
|
36
|
+
if (key.length < MIN_KEY_LENGTH) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Cache key "${key}" is too short. Keys should be at least ${MIN_KEY_LENGTH} characters and include a namespace prefix.`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
// Extract prefix (everything before the last hyphen or the first 10 chars)
|
|
42
|
+
const prefixMatch = key.match(/^([a-z]+-[a-z]+-)/i);
|
|
43
|
+
if (prefixMatch) {
|
|
44
|
+
knownKeyPrefixes.add(prefixMatch[1]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Cache entry structure with value, timestamp, and last access time for LRU eviction.
|
|
50
|
+
*/
|
|
51
|
+
interface CacheEntry<T> {
|
|
52
|
+
value: T;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
lastAccess: number;
|
|
55
|
+
ttlMs?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The global cache Map shared across all functions with LRU eviction support.
|
|
60
|
+
* SECURITY: All cache keys should include a unique namespace prefix to prevent
|
|
61
|
+
* collisions between different caching use cases (e.g., "module-abi-", "ledger-info-").
|
|
7
62
|
* @group Implementation
|
|
8
63
|
* @category Utils
|
|
9
64
|
*/
|
|
10
|
-
const cache = new Map<string,
|
|
65
|
+
const cache = new Map<string, CacheEntry<any>>();
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Track whether cleanup interval is set up.
|
|
69
|
+
*/
|
|
70
|
+
let cleanupIntervalId: ReturnType<typeof setInterval> | null = null;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Sets up periodic cleanup of expired cache entries if not already running.
|
|
74
|
+
* This prevents memory leaks from accumulating expired entries.
|
|
75
|
+
*/
|
|
76
|
+
function ensureCleanupInterval(): void {
|
|
77
|
+
if (cleanupIntervalId === null) {
|
|
78
|
+
cleanupIntervalId = setInterval(() => {
|
|
79
|
+
const now = Date.now();
|
|
80
|
+
const keysToDelete: string[] = [];
|
|
81
|
+
|
|
82
|
+
cache.forEach((entry, key) => {
|
|
83
|
+
// Remove entries that have expired
|
|
84
|
+
if (entry.ttlMs !== undefined && now - entry.timestamp > entry.ttlMs) {
|
|
85
|
+
keysToDelete.push(key);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
keysToDelete.forEach((key) => cache.delete(key));
|
|
90
|
+
|
|
91
|
+
// If cache is empty, stop the cleanup interval to avoid unnecessary overhead
|
|
92
|
+
if (cache.size === 0 && cleanupIntervalId !== null) {
|
|
93
|
+
clearInterval(cleanupIntervalId);
|
|
94
|
+
cleanupIntervalId = null;
|
|
95
|
+
}
|
|
96
|
+
}, CLEANUP_INTERVAL_MS);
|
|
97
|
+
|
|
98
|
+
// Ensure the interval doesn't prevent Node.js from exiting
|
|
99
|
+
if (typeof cleanupIntervalId === "object" && "unref" in cleanupIntervalId) {
|
|
100
|
+
cleanupIntervalId.unref();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Evicts the least recently used entries when cache exceeds maximum size.
|
|
107
|
+
*/
|
|
108
|
+
function evictIfNeeded(): void {
|
|
109
|
+
if (cache.size >= MAX_CACHE_SIZE) {
|
|
110
|
+
// Find and remove the least recently accessed entries (remove ~10% of cache)
|
|
111
|
+
const entriesToRemove = Math.ceil(MAX_CACHE_SIZE * 0.1);
|
|
112
|
+
const entries = Array.from(cache.entries()).sort((a, b) => a[1].lastAccess - b[1].lastAccess);
|
|
113
|
+
|
|
114
|
+
for (let i = 0; i < entriesToRemove && i < entries.length; i += 1) {
|
|
115
|
+
cache.delete(entries[i][0]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
11
119
|
|
|
12
120
|
/**
|
|
13
121
|
* A memoize higher-order function to cache the response of an async function.
|
|
14
122
|
* This function helps to improve performance by avoiding repeated calls to the same async function with the same arguments
|
|
15
123
|
* within a specified time-to-live (TTL).
|
|
16
124
|
*
|
|
125
|
+
* Features:
|
|
126
|
+
* - LRU eviction when cache exceeds MAX_CACHE_SIZE entries
|
|
127
|
+
* - Periodic cleanup of expired entries to prevent memory leaks
|
|
128
|
+
*
|
|
17
129
|
* @param func The async function to cache the result of.
|
|
18
130
|
* @param key The cache key used to store the result.
|
|
19
131
|
* @param ttlMs The time-to-live in milliseconds for cached data.
|
|
@@ -26,20 +138,35 @@ export function memoizeAsync<T>(
|
|
|
26
138
|
key: string,
|
|
27
139
|
ttlMs?: number,
|
|
28
140
|
): (...args: any[]) => Promise<T> {
|
|
141
|
+
// Validate key format on first call to catch misuse early
|
|
142
|
+
validateCacheKey(key);
|
|
143
|
+
|
|
29
144
|
return async (...args: any[]) => {
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
|
|
30
147
|
// Check if the cached result exists and is within TTL
|
|
31
148
|
if (cache.has(key)) {
|
|
32
|
-
const
|
|
33
|
-
if (ttlMs === undefined ||
|
|
34
|
-
|
|
149
|
+
const entry = cache.get(key)!;
|
|
150
|
+
if (ttlMs === undefined || now - entry.timestamp <= ttlMs) {
|
|
151
|
+
// Update last access time for LRU
|
|
152
|
+
entry.lastAccess = now;
|
|
153
|
+
return entry.value;
|
|
35
154
|
}
|
|
155
|
+
// Entry expired, remove it
|
|
156
|
+
cache.delete(key);
|
|
36
157
|
}
|
|
37
158
|
|
|
38
159
|
// If not cached or TTL expired, compute the result
|
|
39
160
|
const result = await func(...args);
|
|
40
161
|
|
|
162
|
+
// Evict old entries if needed before adding new one
|
|
163
|
+
evictIfNeeded();
|
|
164
|
+
|
|
41
165
|
// Cache the result with a timestamp
|
|
42
|
-
cache.set(key, { value: result, timestamp:
|
|
166
|
+
cache.set(key, { value: result, timestamp: now, lastAccess: now, ttlMs });
|
|
167
|
+
|
|
168
|
+
// Ensure cleanup is running
|
|
169
|
+
ensureCleanupInterval();
|
|
43
170
|
|
|
44
171
|
return result;
|
|
45
172
|
};
|
|
@@ -48,6 +175,10 @@ export function memoizeAsync<T>(
|
|
|
48
175
|
/**
|
|
49
176
|
* Caches the result of a function call to improve performance on subsequent calls with the same arguments.
|
|
50
177
|
*
|
|
178
|
+
* Features:
|
|
179
|
+
* - LRU eviction when cache exceeds MAX_CACHE_SIZE entries
|
|
180
|
+
* - Periodic cleanup of expired entries to prevent memory leaks
|
|
181
|
+
*
|
|
51
182
|
* @param key - The key to cache on, all accesses by this key will return the cached value.
|
|
52
183
|
* @param func - The function whose result will be cached.
|
|
53
184
|
* @param ttlMs - The time-to-live in milliseconds for cached data.
|
|
@@ -56,21 +187,56 @@ export function memoizeAsync<T>(
|
|
|
56
187
|
* @category Utils
|
|
57
188
|
*/
|
|
58
189
|
export function memoize<T>(func: (...args: any[]) => T, key: string, ttlMs?: number): (...args: any[]) => T {
|
|
190
|
+
// Validate key format on first call to catch misuse early
|
|
191
|
+
validateCacheKey(key);
|
|
192
|
+
|
|
59
193
|
return (...args: any[]) => {
|
|
194
|
+
const now = Date.now();
|
|
195
|
+
|
|
60
196
|
// Check if the cached result exists and is within TTL
|
|
61
197
|
if (cache.has(key)) {
|
|
62
|
-
const
|
|
63
|
-
if (ttlMs === undefined ||
|
|
64
|
-
|
|
198
|
+
const entry = cache.get(key)!;
|
|
199
|
+
if (ttlMs === undefined || now - entry.timestamp <= ttlMs) {
|
|
200
|
+
// Update last access time for LRU
|
|
201
|
+
entry.lastAccess = now;
|
|
202
|
+
return entry.value;
|
|
65
203
|
}
|
|
204
|
+
// Entry expired, remove it
|
|
205
|
+
cache.delete(key);
|
|
66
206
|
}
|
|
67
207
|
|
|
68
208
|
// If not cached or TTL expired, compute the result
|
|
69
209
|
const result = func(...args);
|
|
70
210
|
|
|
211
|
+
// Evict old entries if needed before adding new one
|
|
212
|
+
evictIfNeeded();
|
|
213
|
+
|
|
71
214
|
// Cache the result with a timestamp
|
|
72
|
-
cache.set(key, { value: result, timestamp:
|
|
215
|
+
cache.set(key, { value: result, timestamp: now, lastAccess: now, ttlMs });
|
|
216
|
+
|
|
217
|
+
// Ensure cleanup is running
|
|
218
|
+
ensureCleanupInterval();
|
|
73
219
|
|
|
74
220
|
return result;
|
|
75
221
|
};
|
|
76
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Clears all entries from the memoization cache.
|
|
226
|
+
* Useful for testing or when you need to force fresh data.
|
|
227
|
+
* @group Implementation
|
|
228
|
+
* @category Utils
|
|
229
|
+
*/
|
|
230
|
+
export function clearMemoizeCache(): void {
|
|
231
|
+
cache.clear();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Returns the current size of the memoization cache.
|
|
236
|
+
* Useful for monitoring and debugging.
|
|
237
|
+
* @group Implementation
|
|
238
|
+
* @category Utils
|
|
239
|
+
*/
|
|
240
|
+
export function getMemoizeCacheSize(): number {
|
|
241
|
+
return cache.size;
|
|
242
|
+
}
|
package/src/version.ts
CHANGED