@aptos-labs/ts-sdk 6.0.0 → 6.1.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/{account-Dpz_N9h-.d.ts → account-CSOaJ0SC.d.ts} +182 -19
- package/dist/common/chunk-3NBJLJ2Y.js +4 -0
- package/dist/common/chunk-3NBJLJ2Y.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- 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 +33 -44
- 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-32J7VMLV.mjs +2 -0
- package/dist/esm/chunk-32J7VMLV.mjs.map +1 -0
- package/dist/esm/chunk-3FDSKP56.mjs +2 -0
- package/dist/esm/chunk-3FDSKP56.mjs.map +1 -0
- package/dist/esm/{chunk-X674XJNJ.mjs → chunk-3Q3J4DTI.mjs} +2 -2
- package/dist/esm/chunk-7FG7RJDS.mjs +2 -0
- package/dist/esm/chunk-7FG7RJDS.mjs.map +1 -0
- package/dist/esm/chunk-BHVMFSAD.mjs +2 -0
- package/dist/esm/chunk-BHVMFSAD.mjs.map +1 -0
- package/dist/esm/chunk-CWI5B5KE.mjs +2 -0
- package/dist/esm/{chunk-QDJDZ3ON.mjs → chunk-DE4YVX3L.mjs} +2 -2
- package/dist/esm/chunk-DECWO3X5.mjs +2 -0
- package/dist/esm/chunk-DECWO3X5.mjs.map +1 -0
- package/dist/esm/{chunk-76SVQZDX.mjs → chunk-DRGODFFX.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-LS2HRAVW.mjs → chunk-G5OONGWS.mjs} +1 -12
- package/dist/esm/chunk-G5OONGWS.mjs.map +1 -0
- package/dist/esm/chunk-GP3CDQFI.mjs +2 -0
- package/dist/esm/chunk-GP3CDQFI.mjs.map +1 -0
- package/dist/esm/chunk-GWM3VCT4.mjs +4 -0
- package/dist/esm/chunk-GWM3VCT4.mjs.map +1 -0
- package/dist/esm/{chunk-C5UZZHA4.mjs → chunk-HHAUJ5E4.mjs} +2 -2
- package/dist/esm/chunk-ITZN23GU.mjs +2 -0
- package/dist/esm/{chunk-G3HAIETV.mjs → chunk-KLDERTLN.mjs} +2 -2
- package/dist/esm/chunk-KLDERTLN.mjs.map +1 -0
- package/dist/esm/chunk-M65PXVDO.mjs +2 -0
- package/dist/esm/chunk-M65PXVDO.mjs.map +1 -0
- package/dist/esm/chunk-ODNZJSOC.mjs +2 -0
- package/dist/esm/chunk-ODNZJSOC.mjs.map +1 -0
- package/dist/esm/{chunk-NTLOKAPD.mjs → chunk-PDNDARQY.mjs} +2 -2
- package/dist/esm/{chunk-RYOICF37.mjs → chunk-POKQD2RK.mjs} +2 -2
- package/dist/esm/chunk-Q5ESW36C.mjs +2 -0
- package/dist/esm/chunk-Q5ESW36C.mjs.map +1 -0
- package/dist/esm/chunk-QRD5NGNC.mjs +2 -0
- package/dist/esm/{chunk-RQN6LA7E.mjs.map → chunk-QRD5NGNC.mjs.map} +1 -1
- package/dist/esm/{chunk-43LWUUXS.mjs → chunk-QV37KEZY.mjs} +2 -2
- package/dist/esm/{chunk-PXJEKGEG.mjs → chunk-QYC3HOQX.mjs} +2 -2
- package/dist/esm/{chunk-CUXCVNES.mjs → chunk-RGXAFBFA.mjs} +2 -2
- package/dist/esm/{chunk-3P474TWM.mjs → chunk-RSUFVB4P.mjs} +2 -2
- package/dist/esm/chunk-SZBXWUBS.mjs +2 -0
- package/dist/esm/chunk-SZBXWUBS.mjs.map +1 -0
- package/dist/esm/{chunk-F3NI6N7R.mjs → chunk-TIMTVXFU.mjs} +2 -2
- package/dist/esm/chunk-TIMTVXFU.mjs.map +1 -0
- package/dist/esm/{chunk-QREVMGQZ.mjs → chunk-U5HTF4OK.mjs} +1 -1
- package/dist/esm/{chunk-QREVMGQZ.mjs.map → chunk-U5HTF4OK.mjs.map} +1 -1
- package/dist/esm/{chunk-6IWGTO2J.mjs → chunk-UNA3V4UB.mjs} +2 -2
- package/dist/esm/chunk-US6KOOYS.mjs +2 -0
- package/dist/esm/chunk-US6KOOYS.mjs.map +1 -0
- package/dist/esm/chunk-UXDYADZV.mjs +2 -0
- package/dist/esm/chunk-UXDYADZV.mjs.map +1 -0
- package/dist/esm/{chunk-5FNZUL2Y.mjs → chunk-UZMJ4DAO.mjs} +2 -2
- package/dist/esm/chunk-V5K2RRFT.mjs +2 -0
- package/dist/esm/chunk-V5K2RRFT.mjs.map +1 -0
- package/dist/esm/{chunk-35DKMW7Q.mjs → chunk-VW3Y5EOJ.mjs} +1 -1
- package/dist/esm/{chunk-35DKMW7Q.mjs.map → chunk-VW3Y5EOJ.mjs.map} +1 -1
- package/dist/esm/{chunk-MEG27LEV.mjs → chunk-VWLK43JM.mjs} +3 -3
- package/dist/esm/chunk-VWLK43JM.mjs.map +1 -0
- package/dist/esm/{chunk-DIFSO4N6.mjs → chunk-VWXVSRRQ.mjs} +2 -2
- package/dist/esm/{chunk-WZ6FL7CH.mjs → chunk-WRV7BWXE.mjs} +2 -2
- package/dist/esm/{chunk-56IXVVXX.mjs → chunk-YMZF4KMT.mjs} +2 -2
- package/dist/esm/{chunk-FW6UHAQV.mjs → chunk-YNNDFGVQ.mjs} +2 -2
- package/dist/esm/{chunk-FW6UHAQV.mjs.map → chunk-YNNDFGVQ.mjs.map} +1 -1
- package/dist/esm/{chunk-52PWWLJJ.mjs → chunk-YOT47DDX.mjs} +2 -2
- package/dist/esm/chunk-YOT47DDX.mjs.map +1 -0
- package/dist/esm/cli/index.d.mts +1 -1
- package/dist/esm/cli/index.mjs +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 +11 -1
- 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 +38 -45
- package/src/account/AbstractKeylessAccount.ts +2 -3
- package/src/account/DerivableAbstractedAccount.ts +1 -3
- package/src/account/EphemeralKeyPair.ts +53 -1
- 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 +3 -2
- package/src/api/aptosConfig.ts +13 -0
- package/src/api/transaction.ts +4 -4
- package/src/api/transactionSubmission/build.ts +1 -5
- package/src/api/transactionSubmission/helpers.ts +1 -1
- package/src/api/transactionSubmission/sign.ts +2 -2
- package/src/bcs/deserializer.ts +64 -17
- package/src/bcs/serializable/movePrimitives.ts +16 -28
- package/src/bcs/serializable/moveStructs.ts +4 -6
- package/src/bcs/serializer.ts +151 -12
- package/src/cli/localNode.ts +2 -3
- package/src/cli/move.ts +5 -5
- package/src/client/get.ts +8 -10
- package/src/core/accountAddress.ts +2 -3
- package/src/core/crypto/abstraction.ts +3 -3
- package/src/core/crypto/ed25519.ts +66 -1
- package/src/core/crypto/federatedKeyless.ts +1 -1
- package/src/core/crypto/keyless.ts +65 -13
- 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 -4
- package/src/core/crypto/secp256k1.ts +68 -3
- package/src/core/crypto/secp256r1.ts +1 -1
- package/src/core/crypto/singleKey.ts +4 -0
- package/src/core/crypto/utils.ts +6 -3
- package/src/errors/index.ts +4 -5
- package/src/internal/account.ts +20 -29
- package/src/internal/ans.ts +5 -6
- package/src/internal/general.ts +24 -6
- package/src/internal/queries/getCollectionData.graphql +0 -11
- package/src/internal/transaction.ts +3 -5
- package/src/internal/transactionSubmission.ts +23 -0
- package/src/transactions/authenticator/account.ts +0 -3
- 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 +7 -6
- package/src/transactions/management/accountSequenceNumber.ts +0 -2
- package/src/transactions/management/transactionWorker.ts +40 -10
- package/src/transactions/transactionBuilder/remoteAbi.ts +21 -6
- package/src/transactions/transactionBuilder/transactionBuilder.ts +13 -9
- package/src/transactions/typeTag/index.ts +1 -1
- package/src/transactions/typeTag/parser.ts +1 -2
- 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 +11 -0
- package/src/utils/helpers.ts +45 -5
- 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-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-F3NI6N7R.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-X674XJNJ.mjs.map → chunk-3Q3J4DTI.mjs.map} +0 -0
- /package/dist/esm/{chunk-KUF4DKN5.mjs.map → chunk-CWI5B5KE.mjs.map} +0 -0
- /package/dist/esm/{chunk-QDJDZ3ON.mjs.map → chunk-DE4YVX3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-76SVQZDX.mjs.map → chunk-DRGODFFX.mjs.map} +0 -0
- /package/dist/esm/{chunk-C5UZZHA4.mjs.map → chunk-HHAUJ5E4.mjs.map} +0 -0
- /package/dist/esm/{chunk-LD3I4CYO.mjs.map → chunk-ITZN23GU.mjs.map} +0 -0
- /package/dist/esm/{chunk-NTLOKAPD.mjs.map → chunk-PDNDARQY.mjs.map} +0 -0
- /package/dist/esm/{chunk-RYOICF37.mjs.map → chunk-POKQD2RK.mjs.map} +0 -0
- /package/dist/esm/{chunk-43LWUUXS.mjs.map → chunk-QV37KEZY.mjs.map} +0 -0
- /package/dist/esm/{chunk-PXJEKGEG.mjs.map → chunk-QYC3HOQX.mjs.map} +0 -0
- /package/dist/esm/{chunk-CUXCVNES.mjs.map → chunk-RGXAFBFA.mjs.map} +0 -0
- /package/dist/esm/{chunk-3P474TWM.mjs.map → chunk-RSUFVB4P.mjs.map} +0 -0
- /package/dist/esm/{chunk-6IWGTO2J.mjs.map → chunk-UNA3V4UB.mjs.map} +0 -0
- /package/dist/esm/{chunk-5FNZUL2Y.mjs.map → chunk-UZMJ4DAO.mjs.map} +0 -0
- /package/dist/esm/{chunk-DIFSO4N6.mjs.map → chunk-VWXVSRRQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-WZ6FL7CH.mjs.map → chunk-WRV7BWXE.mjs.map} +0 -0
- /package/dist/esm/{chunk-56IXVVXX.mjs.map → chunk-YMZF4KMT.mjs.map} +0 -0
package/src/bcs/serializer.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
/* eslint-disable no-bitwise */
|
|
5
4
|
import {
|
|
6
5
|
MAX_U128_BIG_INT,
|
|
7
6
|
MAX_U16_NUMBER,
|
|
@@ -77,6 +76,46 @@ export abstract class Serializable {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Minimum buffer growth increment to avoid too many small reallocations.
|
|
81
|
+
*/
|
|
82
|
+
const MIN_BUFFER_GROWTH = 256;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Shared TextEncoder instance for string serialization to avoid repeated instantiation.
|
|
86
|
+
*/
|
|
87
|
+
const TEXT_ENCODER = new TextEncoder();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pool of reusable Serializer instances for temporary serialization operations.
|
|
91
|
+
* This reduces allocations when using serializeAsBytes() repeatedly.
|
|
92
|
+
*/
|
|
93
|
+
const serializerPool: Serializer[] = [];
|
|
94
|
+
const MAX_POOL_SIZE = 8;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Acquires a Serializer from the pool or creates a new one.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
function acquireSerializer(): Serializer {
|
|
101
|
+
const serializer = serializerPool.pop();
|
|
102
|
+
if (serializer) {
|
|
103
|
+
serializer.reset();
|
|
104
|
+
return serializer;
|
|
105
|
+
}
|
|
106
|
+
return new Serializer();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns a Serializer to the pool for reuse.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
function releaseSerializer(serializer: Serializer): void {
|
|
114
|
+
if (serializerPool.length < MAX_POOL_SIZE) {
|
|
115
|
+
serializerPool.push(serializer);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
80
119
|
/**
|
|
81
120
|
* A class for serializing various data types into a binary format.
|
|
82
121
|
* It provides methods to serialize strings, bytes, numbers, and other serializable objects
|
|
@@ -90,6 +129,12 @@ export class Serializer {
|
|
|
90
129
|
|
|
91
130
|
private offset: number;
|
|
92
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Reusable DataView instance to reduce allocations during serialization.
|
|
134
|
+
* Recreated when buffer is resized.
|
|
135
|
+
*/
|
|
136
|
+
private dataView: DataView;
|
|
137
|
+
|
|
93
138
|
/**
|
|
94
139
|
* Constructs a serializer with a buffer of size `length` bytes, 64 bytes by default.
|
|
95
140
|
* The `length` must be greater than 0.
|
|
@@ -103,23 +148,33 @@ export class Serializer {
|
|
|
103
148
|
throw new Error("Length needs to be greater than 0");
|
|
104
149
|
}
|
|
105
150
|
this.buffer = new ArrayBuffer(length);
|
|
151
|
+
this.dataView = new DataView(this.buffer);
|
|
106
152
|
this.offset = 0;
|
|
107
153
|
}
|
|
108
154
|
|
|
109
155
|
/**
|
|
110
156
|
* Ensures that the internal buffer can accommodate the specified number of bytes.
|
|
111
|
-
* This function dynamically resizes the buffer
|
|
157
|
+
* This function dynamically resizes the buffer using a growth factor of 1.5x with
|
|
158
|
+
* a minimum growth increment to balance memory usage and reallocation frequency.
|
|
112
159
|
*
|
|
113
160
|
* @param bytes - The number of bytes to ensure the buffer can handle.
|
|
114
161
|
* @group Implementation
|
|
115
162
|
* @category BCS
|
|
116
163
|
*/
|
|
117
164
|
private ensureBufferWillHandleSize(bytes: number) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.buffer = newBuffer;
|
|
165
|
+
const requiredSize = this.offset + bytes;
|
|
166
|
+
if (this.buffer.byteLength >= requiredSize) {
|
|
167
|
+
return;
|
|
122
168
|
}
|
|
169
|
+
|
|
170
|
+
// Calculate new size: max of (1.5x current size) or (current + required + MIN_GROWTH)
|
|
171
|
+
// Using 1.5x instead of 2x provides better memory efficiency
|
|
172
|
+
const growthSize = Math.max(Math.floor(this.buffer.byteLength * 1.5), requiredSize + MIN_BUFFER_GROWTH);
|
|
173
|
+
|
|
174
|
+
const newBuffer = new ArrayBuffer(growthSize);
|
|
175
|
+
new Uint8Array(newBuffer).set(new Uint8Array(this.buffer, 0, this.offset));
|
|
176
|
+
this.buffer = newBuffer;
|
|
177
|
+
this.dataView = new DataView(this.buffer);
|
|
123
178
|
}
|
|
124
179
|
|
|
125
180
|
/**
|
|
@@ -137,6 +192,7 @@ export class Serializer {
|
|
|
137
192
|
|
|
138
193
|
/**
|
|
139
194
|
* Serializes a value into the buffer using the provided function, ensuring the buffer can accommodate the size.
|
|
195
|
+
* Uses the cached DataView instance for better performance.
|
|
140
196
|
*
|
|
141
197
|
* @param fn - The function to serialize the value, which takes a byte offset, the value to serialize, and an optional little-endian flag.
|
|
142
198
|
* @param fn.byteOffset - The byte offset at which to write the value.
|
|
@@ -152,8 +208,7 @@ export class Serializer {
|
|
|
152
208
|
value: number,
|
|
153
209
|
) {
|
|
154
210
|
this.ensureBufferWillHandleSize(bytesLength);
|
|
155
|
-
|
|
156
|
-
fn.apply(dv, [0, value, true]);
|
|
211
|
+
fn.apply(this.dataView, [this.offset, value, true]);
|
|
157
212
|
this.offset += bytesLength;
|
|
158
213
|
}
|
|
159
214
|
|
|
@@ -177,8 +232,7 @@ export class Serializer {
|
|
|
177
232
|
* @category BCS
|
|
178
233
|
*/
|
|
179
234
|
serializeStr(value: string) {
|
|
180
|
-
|
|
181
|
-
this.serializeBytes(textEncoder.encode(value));
|
|
235
|
+
this.serializeBytes(TEXT_ENCODER.encode(value));
|
|
182
236
|
}
|
|
183
237
|
|
|
184
238
|
/**
|
|
@@ -473,13 +527,57 @@ export class Serializer {
|
|
|
473
527
|
* Returns the buffered bytes as a Uint8Array.
|
|
474
528
|
*
|
|
475
529
|
* This function allows you to retrieve the byte representation of the buffer up to the current offset.
|
|
530
|
+
* For better performance, returns a view when the buffer is exactly the right size, or copies
|
|
531
|
+
* only the used portion otherwise.
|
|
476
532
|
*
|
|
477
533
|
* @returns Uint8Array - The byte array representation of the buffer.
|
|
478
534
|
* @group Implementation
|
|
479
535
|
* @category BCS
|
|
480
536
|
*/
|
|
481
537
|
toUint8Array(): Uint8Array {
|
|
482
|
-
|
|
538
|
+
// Return a copy of only the used portion of the buffer
|
|
539
|
+
// Using subarray + slice pattern for efficiency
|
|
540
|
+
return new Uint8Array(this.buffer, 0, this.offset).slice();
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Resets the serializer to its initial state, allowing the buffer to be reused.
|
|
545
|
+
* This clears the buffer contents to prevent data leakage between uses.
|
|
546
|
+
*
|
|
547
|
+
* @group Implementation
|
|
548
|
+
* @category BCS
|
|
549
|
+
*/
|
|
550
|
+
reset(): void {
|
|
551
|
+
// Clear buffer contents to prevent data leakage when reusing pooled serializers
|
|
552
|
+
// Only clear the portion that was used (up to offset) for efficiency
|
|
553
|
+
if (this.offset > 0) {
|
|
554
|
+
new Uint8Array(this.buffer, 0, this.offset).fill(0);
|
|
555
|
+
}
|
|
556
|
+
this.offset = 0;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Returns the current number of bytes written to the serializer.
|
|
561
|
+
*
|
|
562
|
+
* @returns The number of bytes written.
|
|
563
|
+
* @group Implementation
|
|
564
|
+
* @category BCS
|
|
565
|
+
*/
|
|
566
|
+
getOffset(): number {
|
|
567
|
+
return this.offset;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Returns a view of the serialized bytes without copying.
|
|
572
|
+
* WARNING: The returned view is only valid until the next write operation.
|
|
573
|
+
* Use toUint8Array() if you need a persistent copy.
|
|
574
|
+
*
|
|
575
|
+
* @returns A Uint8Array view of the buffer (not a copy).
|
|
576
|
+
* @group Implementation
|
|
577
|
+
* @category BCS
|
|
578
|
+
*/
|
|
579
|
+
toUint8ArrayView(): Uint8Array {
|
|
580
|
+
return new Uint8Array(this.buffer, 0, this.offset);
|
|
483
581
|
}
|
|
484
582
|
|
|
485
583
|
/**
|
|
@@ -497,6 +595,47 @@ export class Serializer {
|
|
|
497
595
|
value.serialize(this);
|
|
498
596
|
}
|
|
499
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Serializes a Serializable value as a byte array with a length prefix.
|
|
600
|
+
* This is the optimized pattern for entry function argument serialization.
|
|
601
|
+
*
|
|
602
|
+
* Instead of:
|
|
603
|
+
* ```typescript
|
|
604
|
+
* const bcsBytes = value.bcsToBytes(); // Creates new Serializer, copies bytes
|
|
605
|
+
* serializer.serializeBytes(bcsBytes);
|
|
606
|
+
* ```
|
|
607
|
+
*
|
|
608
|
+
* Use:
|
|
609
|
+
* ```typescript
|
|
610
|
+
* serializer.serializeAsBytes(value); // Uses pooled Serializer, avoids extra copy
|
|
611
|
+
* ```
|
|
612
|
+
*
|
|
613
|
+
* This method uses a pooled Serializer instance to reduce allocations and
|
|
614
|
+
* directly appends the serialized bytes with a length prefix.
|
|
615
|
+
*
|
|
616
|
+
* @param value - The Serializable value to serialize as bytes.
|
|
617
|
+
* @group Implementation
|
|
618
|
+
* @category BCS
|
|
619
|
+
*/
|
|
620
|
+
serializeAsBytes<T extends Serializable>(value: T): void {
|
|
621
|
+
// Acquire a pooled serializer for temporary use
|
|
622
|
+
const tempSerializer = acquireSerializer();
|
|
623
|
+
|
|
624
|
+
try {
|
|
625
|
+
// Serialize the value to the temporary serializer
|
|
626
|
+
value.serialize(tempSerializer);
|
|
627
|
+
|
|
628
|
+
// Get the serialized bytes (as a view to avoid copying)
|
|
629
|
+
const bytes = tempSerializer.toUint8ArrayView();
|
|
630
|
+
|
|
631
|
+
// Serialize with length prefix to this serializer
|
|
632
|
+
this.serializeBytes(bytes);
|
|
633
|
+
} finally {
|
|
634
|
+
// Return the serializer to the pool for reuse
|
|
635
|
+
releaseSerializer(tempSerializer);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
500
639
|
/**
|
|
501
640
|
* Serializes an array of BCS Serializable values to a serializer instance.
|
|
502
641
|
* The bytes are added to the serializer instance's byte buffer.
|
|
@@ -630,7 +769,7 @@ export function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T
|
|
|
630
769
|
function checkNumberRange<T extends AnyNumber>(minValue: T, maxValue: T) {
|
|
631
770
|
return (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
632
771
|
const childFunction = descriptor.value;
|
|
633
|
-
|
|
772
|
+
|
|
634
773
|
descriptor.value = function deco(value: AnyNumber) {
|
|
635
774
|
validateNumberInRange(value, minValue, maxValue);
|
|
636
775
|
return childFunction.apply(this, [value]);
|
package/src/cli/localNode.ts
CHANGED
|
@@ -130,9 +130,8 @@ export class LocalNode {
|
|
|
130
130
|
let last = start;
|
|
131
131
|
|
|
132
132
|
while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {
|
|
133
|
-
// eslint-disable-next-line no-await-in-loop
|
|
134
133
|
await sleep(1000);
|
|
135
|
-
|
|
134
|
+
|
|
136
135
|
operational = await this.checkIfProcessIsUp();
|
|
137
136
|
last = Date.now() / 1000;
|
|
138
137
|
}
|
|
@@ -161,7 +160,7 @@ export class LocalNode {
|
|
|
161
160
|
return true;
|
|
162
161
|
}
|
|
163
162
|
return false;
|
|
164
|
-
} catch
|
|
163
|
+
} catch {
|
|
165
164
|
return false;
|
|
166
165
|
}
|
|
167
166
|
}
|
package/src/cli/move.ts
CHANGED
|
@@ -353,7 +353,7 @@ export class Move {
|
|
|
353
353
|
* @group Implementation
|
|
354
354
|
* @category CLI
|
|
355
355
|
*/
|
|
356
|
-
|
|
356
|
+
|
|
357
357
|
private async runCommand(args: Array<string>, showStdout: boolean = true): Promise<{ result?: any; output: string }> {
|
|
358
358
|
return new Promise((resolve, reject) => {
|
|
359
359
|
const currentPlatform = platform();
|
|
@@ -391,7 +391,7 @@ export class Move {
|
|
|
391
391
|
} else if (parsed.Result) {
|
|
392
392
|
resolve({ result: parsed.Result, output: stdout }); // Resolve if the "Result" key exists
|
|
393
393
|
}
|
|
394
|
-
} catch
|
|
394
|
+
} catch {
|
|
395
395
|
// resolve the stdout as it might be just a stdout
|
|
396
396
|
resolve({ output: stdout });
|
|
397
397
|
}
|
|
@@ -411,7 +411,7 @@ export class Move {
|
|
|
411
411
|
* @group Implementation
|
|
412
412
|
* @category CLI
|
|
413
413
|
*/
|
|
414
|
-
|
|
414
|
+
|
|
415
415
|
private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {
|
|
416
416
|
const totalNames = namedAddresses.size;
|
|
417
417
|
const newArgs: Array<string> = [];
|
|
@@ -442,7 +442,7 @@ export class Move {
|
|
|
442
442
|
* @group Implementation
|
|
443
443
|
* @category CLI
|
|
444
444
|
*/
|
|
445
|
-
|
|
445
|
+
|
|
446
446
|
private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {
|
|
447
447
|
const addressesMap = new Map();
|
|
448
448
|
|
|
@@ -463,7 +463,7 @@ export class Move {
|
|
|
463
463
|
* @group Implementation
|
|
464
464
|
* @category CLI
|
|
465
465
|
*/
|
|
466
|
-
|
|
466
|
+
|
|
467
467
|
private extractAddressFromOutput(output: string): string {
|
|
468
468
|
const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");
|
|
469
469
|
if (match) {
|
package/src/client/get.ts
CHANGED
|
@@ -162,11 +162,10 @@ export async function getAptosPepperService<Req extends {}, Res extends {}>(
|
|
|
162
162
|
export async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(
|
|
163
163
|
options: GetAptosRequestOptions,
|
|
164
164
|
): Promise<Res> {
|
|
165
|
-
|
|
165
|
+
let out: Res = [] as unknown as Res;
|
|
166
166
|
let cursor: string | undefined;
|
|
167
167
|
const requestParams = options.params as { start?: string; limit?: number };
|
|
168
168
|
do {
|
|
169
|
-
// eslint-disable-next-line no-await-in-loop
|
|
170
169
|
const response = await get<Req, Res>({
|
|
171
170
|
type: AptosApiType.FULLNODE,
|
|
172
171
|
aptosConfig: options.aptosConfig,
|
|
@@ -186,7 +185,8 @@ export async function paginateWithCursor<Req extends Record<string, any>, Res ex
|
|
|
186
185
|
// Now that we have the cursor (if any), we remove the headers before
|
|
187
186
|
// adding these to the output of this function.
|
|
188
187
|
delete response.headers;
|
|
189
|
-
|
|
188
|
+
// Use concat instead of push(...) for better performance with large arrays
|
|
189
|
+
out = out.concat(response.data) as Res;
|
|
190
190
|
requestParams.start = cursor;
|
|
191
191
|
} while (cursor !== null && cursor !== undefined);
|
|
192
192
|
return out;
|
|
@@ -196,12 +196,11 @@ export async function paginateWithCursor<Req extends Record<string, any>, Res ex
|
|
|
196
196
|
export async function paginateWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(
|
|
197
197
|
options: GetAptosRequestOptions,
|
|
198
198
|
): Promise<Res> {
|
|
199
|
-
|
|
199
|
+
let out: Res = [] as unknown as Res;
|
|
200
200
|
let cursor: string | undefined;
|
|
201
201
|
const requestParams = options.params as { start?: string; limit?: number };
|
|
202
202
|
const totalLimit = requestParams.limit;
|
|
203
203
|
do {
|
|
204
|
-
// eslint-disable-next-line no-await-in-loop
|
|
205
204
|
const { response, cursor: newCursor } = await getPageWithObfuscatedCursor<Req, Res>({ ...options });
|
|
206
205
|
|
|
207
206
|
/**
|
|
@@ -210,7 +209,8 @@ export async function paginateWithObfuscatedCursor<Req extends Record<string, an
|
|
|
210
209
|
* to query the next chunk of data.
|
|
211
210
|
*/
|
|
212
211
|
cursor = newCursor;
|
|
213
|
-
|
|
212
|
+
// Use concat instead of push(...) for better performance with large arrays
|
|
213
|
+
out = out.concat(response.data) as Res;
|
|
214
214
|
if (options?.params) {
|
|
215
215
|
options.params.start = cursor;
|
|
216
216
|
}
|
|
@@ -230,8 +230,7 @@ export async function paginateWithObfuscatedCursor<Req extends Record<string, an
|
|
|
230
230
|
export async function getPageWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(
|
|
231
231
|
options: GetAptosRequestOptions,
|
|
232
232
|
): Promise<{ response: AptosResponse<Req, Res>; cursor: string | undefined }> {
|
|
233
|
-
|
|
234
|
-
let requestParams: { start?: string; limit?: number } = {};
|
|
233
|
+
const requestParams: { start?: string; limit?: number } = {};
|
|
235
234
|
|
|
236
235
|
// Drop any other values
|
|
237
236
|
// TODO: Throw error if cursor is not a string
|
|
@@ -242,7 +241,6 @@ export async function getPageWithObfuscatedCursor<Req extends Record<string, any
|
|
|
242
241
|
requestParams.limit = options.params.limit;
|
|
243
242
|
}
|
|
244
243
|
|
|
245
|
-
// eslint-disable-next-line no-await-in-loop
|
|
246
244
|
const response = await get<Req, Res>({
|
|
247
245
|
type: AptosApiType.FULLNODE,
|
|
248
246
|
aptosConfig: options.aptosConfig,
|
|
@@ -257,6 +255,6 @@ export async function getPageWithObfuscatedCursor<Req extends Record<string, any
|
|
|
257
255
|
* should not need to "care" what it represents but just use it
|
|
258
256
|
* to query the next chunk of data.
|
|
259
257
|
*/
|
|
260
|
-
cursor = response.headers["x-aptos-cursor"];
|
|
258
|
+
const cursor = response.headers["x-aptos-cursor"] ?? undefined;
|
|
261
259
|
return { response, cursor };
|
|
262
260
|
}
|
|
@@ -240,14 +240,14 @@ export class AccountAddress extends Serializable implements TransactionArgument
|
|
|
240
240
|
/**
|
|
241
241
|
* Serializes the current instance into a byte sequence suitable for entry functions.
|
|
242
242
|
* This allows for the proper encoding of data when interacting with entry functions in the blockchain.
|
|
243
|
+
* Uses the optimized serializeAsBytes method to reduce allocations.
|
|
243
244
|
*
|
|
244
245
|
* @param serializer - The serializer instance used to convert the data into bytes.
|
|
245
246
|
* @group Implementation
|
|
246
247
|
* @category Serialization
|
|
247
248
|
*/
|
|
248
249
|
serializeForEntryFunction(serializer: Serializer): void {
|
|
249
|
-
|
|
250
|
-
serializer.serializeBytes(bcsBytes);
|
|
250
|
+
serializer.serializeAsBytes(this);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
@@ -339,7 +339,6 @@ export class AccountAddress extends Serializable implements TransactionArgument
|
|
|
339
339
|
} else if (input.length !== 3) {
|
|
340
340
|
// 0x + one hex char is the only valid SHORT form for special addresses.
|
|
341
341
|
throw new ParsingError(
|
|
342
|
-
// eslint-disable-next-line max-len
|
|
343
342
|
`The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,
|
|
344
343
|
AddressInvalidReason.INVALID_PADDING_ZEROES,
|
|
345
344
|
);
|
|
@@ -35,17 +35,17 @@ export class AbstractPublicKey extends AccountPublicKey {
|
|
|
35
35
|
return new AuthenticationKey({ data: this.accountAddress.toUint8Array() });
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// eslint-disable-next-line
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
39
|
verifySignature(args: VerifySignatureArgs): boolean {
|
|
40
40
|
throw new Error("This function is not implemented for AbstractPublicKey.");
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// eslint-disable-next-line
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
44
|
async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {
|
|
45
45
|
throw new Error("This function is not implemented for AbstractPublicKey.");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// eslint-disable-next-line
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
49
|
serialize(serializer: Serializer): void {
|
|
50
50
|
throw new Error("This function is not implemented for AbstractPublicKey.");
|
|
51
51
|
}
|
|
@@ -250,7 +250,13 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
250
250
|
* @group Implementation
|
|
251
251
|
* @category Serialization
|
|
252
252
|
*/
|
|
253
|
-
private
|
|
253
|
+
private signingKey: Hex;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Whether the key has been cleared from memory
|
|
257
|
+
* @private
|
|
258
|
+
*/
|
|
259
|
+
private cleared: boolean = false;
|
|
254
260
|
|
|
255
261
|
// region Constructors
|
|
256
262
|
|
|
@@ -336,14 +342,63 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
336
342
|
|
|
337
343
|
// region PrivateKey
|
|
338
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Checks if the key has been cleared and throws an error if so.
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
private ensureNotCleared(): void {
|
|
350
|
+
if (this.cleared) {
|
|
351
|
+
throw new Error("Private key has been cleared from memory and can no longer be used");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Clears the private key from memory by overwriting it with random bytes.
|
|
357
|
+
* After calling this method, the private key can no longer be used for signing or deriving public keys.
|
|
358
|
+
*
|
|
359
|
+
* Note: Due to JavaScript's memory management, this cannot guarantee complete removal of
|
|
360
|
+
* sensitive data from memory, but it significantly reduces the window of exposure.
|
|
361
|
+
*
|
|
362
|
+
* @group Implementation
|
|
363
|
+
* @category Serialization
|
|
364
|
+
*/
|
|
365
|
+
clear(): void {
|
|
366
|
+
if (!this.cleared) {
|
|
367
|
+
const keyBytes = this.signingKey.toUint8Array();
|
|
368
|
+
// Multiple overwrite passes for better security
|
|
369
|
+
// Pass 1: Random data
|
|
370
|
+
crypto.getRandomValues(keyBytes);
|
|
371
|
+
// Pass 2: Ones pattern (0xFF)
|
|
372
|
+
keyBytes.fill(0xff);
|
|
373
|
+
// Pass 3: Random data again
|
|
374
|
+
crypto.getRandomValues(keyBytes);
|
|
375
|
+
// Pass 4: Zeros pattern (final state)
|
|
376
|
+
keyBytes.fill(0);
|
|
377
|
+
this.cleared = true;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Returns whether the private key has been cleared from memory.
|
|
383
|
+
*
|
|
384
|
+
* @returns true if the key has been cleared, false otherwise
|
|
385
|
+
* @group Implementation
|
|
386
|
+
* @category Serialization
|
|
387
|
+
*/
|
|
388
|
+
isCleared(): boolean {
|
|
389
|
+
return this.cleared;
|
|
390
|
+
}
|
|
391
|
+
|
|
339
392
|
/**
|
|
340
393
|
* Derive the Ed25519PublicKey for this private key.
|
|
341
394
|
*
|
|
342
395
|
* @returns Ed25519PublicKey - The derived public key corresponding to the private key.
|
|
396
|
+
* @throws Error if the private key has been cleared from memory.
|
|
343
397
|
* @group Implementation
|
|
344
398
|
* @category Serialization
|
|
345
399
|
*/
|
|
346
400
|
publicKey(): Ed25519PublicKey {
|
|
401
|
+
this.ensureNotCleared();
|
|
347
402
|
const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());
|
|
348
403
|
return new Ed25519PublicKey(bytes);
|
|
349
404
|
}
|
|
@@ -354,10 +409,12 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
354
409
|
*
|
|
355
410
|
* @param message - A message as a string or Uint8Array in HexInput format.
|
|
356
411
|
* @returns A digital signature for the provided message.
|
|
412
|
+
* @throws Error if the private key has been cleared from memory.
|
|
357
413
|
* @group Implementation
|
|
358
414
|
* @category Serialization
|
|
359
415
|
*/
|
|
360
416
|
sign(message: HexInput): Ed25519Signature {
|
|
417
|
+
this.ensureNotCleared();
|
|
361
418
|
const messageToSign = convertSigningMessage(message);
|
|
362
419
|
const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();
|
|
363
420
|
const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());
|
|
@@ -368,10 +425,12 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
368
425
|
* Get the private key in bytes (Uint8Array).
|
|
369
426
|
*
|
|
370
427
|
* @returns Uint8Array representation of the private key
|
|
428
|
+
* @throws Error if the private key has been cleared from memory.
|
|
371
429
|
* @group Implementation
|
|
372
430
|
* @category Serialization
|
|
373
431
|
*/
|
|
374
432
|
toUint8Array(): Uint8Array {
|
|
433
|
+
this.ensureNotCleared();
|
|
375
434
|
return this.signingKey.toUint8Array();
|
|
376
435
|
}
|
|
377
436
|
|
|
@@ -379,10 +438,12 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
379
438
|
* Get the private key as a hex string with the 0x prefix.
|
|
380
439
|
*
|
|
381
440
|
* @returns string representation of the private key.
|
|
441
|
+
* @throws Error if the private key has been cleared from memory.
|
|
382
442
|
* @group Implementation
|
|
383
443
|
* @category Serialization
|
|
384
444
|
*/
|
|
385
445
|
toString(): string {
|
|
446
|
+
this.ensureNotCleared();
|
|
386
447
|
return this.toAIP80String();
|
|
387
448
|
}
|
|
388
449
|
|
|
@@ -390,8 +451,10 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
390
451
|
* Get the private key as a hex string with the 0x prefix.
|
|
391
452
|
*
|
|
392
453
|
* @returns string representation of the private key.
|
|
454
|
+
* @throws Error if the private key has been cleared from memory.
|
|
393
455
|
*/
|
|
394
456
|
toHexString(): string {
|
|
457
|
+
this.ensureNotCleared();
|
|
395
458
|
return this.signingKey.toString();
|
|
396
459
|
}
|
|
397
460
|
|
|
@@ -401,8 +464,10 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
|
401
464
|
* [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
|
|
402
465
|
*
|
|
403
466
|
* @returns AIP-80 compliant string representation of the private key.
|
|
467
|
+
* @throws Error if the private key has been cleared from memory.
|
|
404
468
|
*/
|
|
405
469
|
toAIP80String(): string {
|
|
470
|
+
this.ensureNotCleared();
|
|
406
471
|
return PrivateKey.formatPrivateKey(this.signingKey.toString(), PrivateKeyVariants.Ed25519);
|
|
407
472
|
}
|
|
408
473
|
|