diff --git a/circular.json b/circular.json
new file mode 100644
index 000000000..b5870ac24
--- /dev/null
+++ b/circular.json
@@ -0,0 +1,1954 @@
+[
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts"
+ ],
+ [
+ "account/AbstractKeylessAccount.ts",
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts"
+ ],
+ [
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts"
+ ],
+ [
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/deserializer.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/deserializer.ts",
+ "core/hex.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/deserializer.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/entryFunctionBytes.ts",
+ "bcs/serializable/fixedBytes.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/entryFunctionBytes.ts",
+ "bcs/serializable/fixedBytes.ts",
+ "transactions/instances/transactionArgument.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/entryFunctionBytes.ts",
+ "bcs/serializable/fixedBytes.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/entryFunctionBytes.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/entryFunctionBytes.ts"
+ ],
+ [
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/movePrimitives.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/movePrimitives.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/movePrimitives.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/moveStructs.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts",
+ "bcs/serializable/moveStructs.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "bcs/index.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/accountAddress.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/accountAddress.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/abstraction.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/abstraction.ts",
+ "core/crypto/publicKey.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/abstraction.ts",
+ "core/crypto/publicKey.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/abstraction.ts",
+ "core/crypto/publicKey.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/abstraction.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/deserializationUtils.ts",
+ "core/index.ts",
+ "core/account/index.ts",
+ "core/account/utils/index.ts",
+ "core/account/utils/address.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/deserializationUtils.ts",
+ "core/index.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/deserializationUtils.ts",
+ "core/index.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/deserializationUtils.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/ephemeral.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/ephemeral.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/ephemeral.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "api/aptosConfig.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "client/index.ts",
+ "client/core.ts",
+ "errors/index.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "client/index.ts",
+ "client/core.ts",
+ "errors/index.ts",
+ "utils/helpers.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "client/index.ts",
+ "client/core.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "client/index.ts",
+ "client/get.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "client/index.ts",
+ "client/post.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts"
+ ],
+ [
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts"
+ ],
+ [
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts"
+ ],
+ [
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts"
+ ],
+ [
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts"
+ ],
+ [
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts"
+ ],
+ [
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts"
+ ],
+ [
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256k1.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256k1.ts",
+ "core/crypto/privateKey.ts"
+ ],
+ [
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256k1.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256k1.ts"
+ ],
+ [
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256r1.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts",
+ "core/crypto/secp256r1.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts",
+ "core/crypto/singleKey.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts",
+ "core/crypto/multiKey.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/multiEd25519.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts",
+ "core/crypto/types.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "core/crypto/utils.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/general.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/table.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transaction.ts"
+ ],
+ [
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts"
+ ],
+ [
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts"
+ ],
+ [
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/chainId.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts",
+ "transactions/instances/identifier.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts",
+ "transactions/instances/moduleId.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts",
+ "transactions/instances/moduleId.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts",
+ "transactions/typeTag/index.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts",
+ "transactions/typeTag/index.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts",
+ "transactions/instances/transactionPayload.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/multiAgentTransaction.ts",
+ "transactions/instances/rawTransaction.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/instances/simpleTransaction.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts"
+ ],
+ [
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "internal/utils/index.ts",
+ "internal/utils/utils.ts"
+ ],
+ [
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts"
+ ],
+ [
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/authenticator/transaction.ts"
+ ],
+ [
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/authenticator/transaction.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/authenticator/transaction.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/instances/index.ts",
+ "transactions/instances/rotationProofChallenge.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/instances/index.ts",
+ "transactions/instances/rotationProofChallenge.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/instances/index.ts",
+ "transactions/instances/rotationProofChallenge.ts"
+ ],
+ [
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/instances/index.ts",
+ "transactions/instances/signedTransaction.ts"
+ ],
+ [
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/helpers.ts",
+ "transactions/types.ts"
+ ],
+ [
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/helpers.ts",
+ "transactions/types.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/helpers.ts",
+ "transactions/types.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/helpers.ts"
+ ],
+ [
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/remoteAbi.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts",
+ "transactions/transactionBuilder/transactionBuilder.ts",
+ "transactions/transactionBuilder/remoteAbi.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/transactionSubmission.ts"
+ ],
+ [
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/view.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts",
+ "internal/view.ts"
+ ],
+ [
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/accountSequenceNumber.ts",
+ "internal/account.ts"
+ ],
+ [
+ "account/index.ts",
+ "account/AbstractedAccount.ts",
+ "bcs/serializer.ts",
+ "bcs/consts.ts",
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/transactionWorker.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts",
+ "transactions/management/index.ts",
+ "transactions/management/transactionWorker.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts",
+ "index.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts",
+ "core/crypto/keyless.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts",
+ "core/crypto/index.ts",
+ "core/crypto/federatedKeyless.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts",
+ "core/authenticationKey.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts",
+ "core/crypto/ed25519.ts"
+ ],
+ [
+ "types/index.ts",
+ "types/types.ts",
+ "transactions/index.ts",
+ "transactions/authenticator/index.ts",
+ "transactions/authenticator/account.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts"
+ ],
+ [
+ "account/AbstractKeylessAccount.ts",
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts"
+ ],
+ [
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts"
+ ],
+ [
+ "account/AbstractKeylessAccount.ts",
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/FederatedKeylessAccount.ts"
+ ],
+ [
+ "account/AbstractKeylessAccount.ts",
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/KeylessAccount.ts"
+ ],
+ [
+ "account/AbstractKeylessAccount.ts",
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts"
+ ],
+ [
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts",
+ "account/SingleKeyAccount.ts"
+ ],
+ [
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts",
+ "account/SingleKeyAccount.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/AccountUtils.ts",
+ "account/MultiKeyAccount.ts",
+ "account/SingleKeyAccount.ts"
+ ],
+ [
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts"
+ ],
+ [
+ "account/Account.ts",
+ "account/Ed25519Account.ts",
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/MultiEd25519Account.ts"
+ ],
+ [
+ "api/index.ts",
+ "api/aptos.ts",
+ "api/account.ts",
+ "account/index.ts",
+ "account/MultiEd25519Account.ts"
+ ]
+]
diff --git a/graph.svg b/graph.svg
new file mode 100644
index 000000000..f64322283
--- /dev/null
+++ b/graph.svg
@@ -0,0 +1,5851 @@
+
+
+
+
+
diff --git a/packages/bcs/package.json b/packages/bcs/package.json
new file mode 100644
index 000000000..9a4230cc1
--- /dev/null
+++ b/packages/bcs/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@aptos-labs/bcs",
+ "version": "1.0.0",
+ "description": "BCS (Binary Canonical Serialization) library for Aptos",
+ "main": "./dist/cjs/index.js",
+ "module": "./dist/esm/index.mjs",
+ "types": "./dist/esm/index.d.mts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.mts",
+ "default": "./dist/esm/index.mjs"
+ },
+ "require": {
+ "types": "./dist/cjs/index.d.ts",
+ "default": "./dist/cjs/index.js"
+ }
+ }
+ },
+ "files": [
+ "dist",
+ "package.json"
+ ],
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "aptos",
+ "bcs",
+ "serialization"
+ ],
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@aptos-labs/utils": "workspace:*",
+ "@noble/hashes": "^1.5.0"
+ },
+ "devDependencies": {
+ "tsup": "^8.5.0",
+ "typescript": "^5.8.3"
+ }
+}
+
diff --git a/packages/bcs/src/consts.ts b/packages/bcs/src/consts.ts
new file mode 100644
index 000000000..9844fd604
--- /dev/null
+++ b/packages/bcs/src/consts.ts
@@ -0,0 +1,19 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+import { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from "./types";
+
+// Upper bound values for uint8, uint16, uint64 etc. These are all derived as
+// 2^N - 1, where N is the number of bits in the type.
+export const MAX_U8_NUMBER: Uint8 = 255;
+export const MAX_U16_NUMBER: Uint16 = 65535;
+export const MAX_U32_NUMBER: Uint32 = 4294967295;
+export const MAX_U64_BIG_INT: Uint64 = 18446744073709551615n;
+export const MAX_U128_BIG_INT: Uint128 = 340282366920938463463374607431768211455n;
+export const MAX_U256_BIG_INT: Uint256 =
+ 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
+
+
+
+
+
diff --git a/packages/bcs/src/deserializer.ts b/packages/bcs/src/deserializer.ts
new file mode 100644
index 000000000..521ae792c
--- /dev/null
+++ b/packages/bcs/src/deserializer.ts
@@ -0,0 +1,418 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+/* eslint-disable no-bitwise */
+import { MAX_U32_NUMBER } from "./consts";
+import { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from "./types";
+import { fromHexInput, HexInput } from "@aptos-labs/utils";
+
+export interface Deserializable {
+ deserialize(deserializer: Deserializer): T
+}
+
+/**
+ * A class that provides methods for deserializing various data types from a byte buffer.
+ * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.
+ * @group Implementation
+ * @category BCS
+ */
+export class Deserializer {
+ private buffer: ArrayBuffer;
+
+ private offset: number;
+
+ /**
+ * Creates a new instance of the class with a copy of the provided data buffer.
+ * This prevents outside mutation of the buffer.
+ *
+ * @param data - The data to be copied into the internal buffer as a Uint8Array.
+ * @group Implementation
+ * @category BCS
+ */
+ constructor(data: Uint8Array) {
+ // copies data to prevent outside mutation of buffer.
+ this.buffer = new ArrayBuffer(data.length);
+ new Uint8Array(this.buffer).set(data, 0);
+ this.offset = 0;
+ }
+
+ static fromHex(hex: HexInput): Deserializer {
+ return new Deserializer(fromHexInput(hex));
+ }
+
+ /**
+ * Reads a specified number of bytes from the buffer and advances the offset.
+ *
+ * @param length - The number of bytes to read from the buffer.
+ * @throws Throws an error if the read operation exceeds the buffer's length.
+ * @group Implementation
+ * @category BCS
+ */
+ private read(length: number): ArrayBuffer {
+ if (this.offset + length > this.buffer.byteLength) {
+ throw new Error("Reached to the end of buffer");
+ }
+
+ const bytes = this.buffer.slice(this.offset, this.offset + length);
+ this.offset += length;
+ return bytes;
+ }
+
+ /**
+ * Returns the number of bytes remaining in the buffer.
+ *
+ * This information is useful to determine if there's more data to be read.
+ *
+ * @returns The number of bytes remaining in the buffer.
+ * @group Implementation
+ * @category BCS
+ */
+ remaining(): number {
+ return this.buffer.byteLength - this.offset;
+ }
+
+ /**
+ * Asserts that the buffer has no remaining bytes.
+ *
+ * @throws {Error} Throws an error if there are remaining bytes in the buffer.
+ * @group Implementation
+ * @category BCS
+ */
+ assertFinished(): void {
+ if (this.remaining() !== 0) {
+ throw new Error("Buffer has remaining bytes");
+ }
+ }
+
+ /**
+ * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,
+ * followed by the actual byte content, and decodes it into a string.
+ *
+ * BCS layout for "string": string_length | string_content
+ * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
+ *
+ * @example
+ * ```typescript
+ * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
+ * assert(deserializer.deserializeStr() === "1234abcd");
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeStr(): string {
+ const value = this.deserializeBytes();
+ const textDecoder = new TextDecoder();
+ return textDecoder.decode(value);
+ }
+
+ /**
+ * @deprecated use `deserializeOption("string")` instead.
+ *
+ * The BCS layout for Optional is 0 if none, else 1 followed by the string length and string content.
+ * @returns The deserialized string if it exists, otherwise undefined.
+ * @example
+ * ```typescript
+ * const deserializer = new Deserializer(new Uint8Array([0x00]));
+ * assert(deserializer.deserializeOptionStr() === undefined);
+ * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
+ * assert(deserializer.deserializeOptionStr() === "1234abcd");
+ * ```
+ */
+ deserializeOptionStr(): string | undefined {
+ return this.deserializeOption("string");
+ }
+
+ /**
+ * Deserializes an optional value from the buffer.
+ *
+ * The BCS layout for Optional starts with a boolean byte (0 if none, 1 if some),
+ * followed by the value if present.
+ *
+ * @template T - The type of the value to deserialize
+ * @param type - Either a Deserializable class or one of the string literals: "string", "bytes", or "fixedBytes"
+ * @param len - Required length when type is "fixedBytes", ignored otherwise
+ * @returns The deserialized value if present, undefined otherwise
+ *
+ * @throws {Error} When "fixedBytes" is specified without a length
+ *
+ * @example
+ * ```typescript
+ * // Deserialize an optional string
+ * const deserializer = new Deserializer(new Uint8Array([1, 3, 97, 98, 99]));
+ * const optStr = deserializer.deserializeOption("string");
+ * // optStr === "abc"
+ *
+ * // Deserialize an optional custom type
+ * const deserializer = new Deserializer(new Uint8Array([0]));
+ * const optValue = deserializer.deserializeOption(MyClass);
+ * // optValue === undefined
+ *
+ * // Deserialize optional bytes
+ * const deserializer = new Deserializer(new Uint8Array([1, 3, 1, 2, 3]));
+ * const optBytes = deserializer.deserializeOption("bytes");
+ * // optBytes === Uint8Array[1, 2, 3]
+ *
+ * // Deserialize optional fixed bytes
+ * const deserializer = new Deserializer(new Uint8Array([1, 1, 2, 3, 4]));
+ * const optBytes = deserializer.deserializeOption("fixedBytes", 4);
+ * // optBytes === Uint8Array[1, 2, 3, 4]
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeOption(type: "string"): string | undefined;
+ deserializeOption(type: "bytes"): Uint8Array | undefined;
+ deserializeOption(type: "fixedBytes", len: number): Uint8Array | undefined;
+ deserializeOption(type: Deserializable): T | undefined;
+ deserializeOption(
+ type: Deserializable | "string" | "bytes" | "fixedBytes",
+ len?: number,
+ ): T | string | Uint8Array | undefined {
+ const exists = this.deserializeBool();
+ if (!exists) return undefined;
+
+ if (type === "string") {
+ return this.deserializeStr();
+ }
+ if (type === "bytes") {
+ return this.deserializeBytes();
+ }
+ if (type === "fixedBytes") {
+ if (len === undefined) {
+ throw new Error("Fixed bytes length not provided");
+ }
+ return this.deserializeFixedBytes(len);
+ }
+
+ return this.deserialize(type);
+ }
+
+ /**
+ * Deserializes an array of bytes.
+ *
+ * The BCS layout for "bytes" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer
+ * encoded as a uleb128 integer, indicating the length of the bytes array.
+ *
+ * @returns {Uint8Array} The deserialized array of bytes.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeBytes(): Uint8Array {
+ const len = this.deserializeUleb128AsU32();
+ return new Uint8Array(this.read(len));
+ }
+
+ /**
+ * Deserializes an array of bytes of a specified length.
+ *
+ * @param len - The number of bytes to read from the source.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeFixedBytes(len: number): Uint8Array {
+ return new Uint8Array(this.read(len));
+ }
+
+ /**
+ * Deserializes a boolean value from a byte stream.
+ *
+ * The BCS layout for a boolean uses one byte, where "0x01" represents true and "0x00" represents false.
+ * An error is thrown if the byte value is not valid.
+ *
+ * @returns The deserialized boolean value.
+ * @throws Throws an error if the boolean value is invalid.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeBool(): boolean {
+ const bool = new Uint8Array(this.read(1))[0];
+ if (bool !== 1 && bool !== 0) {
+ throw new Error("Invalid boolean value");
+ }
+ return bool === 1;
+ }
+
+ /**
+ * Deserializes a uint8 number from the binary data.
+ *
+ * BCS layout for "uint8": One byte. Binary format in little-endian representation.
+ *
+ * @returns {number} The deserialized uint8 number.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU8(): Uint8 {
+ return new DataView(this.read(1)).getUint8(0);
+ }
+
+ /**
+ * Deserializes a uint16 number from a binary format in little-endian representation.
+ *
+ * BCS layout for "uint16": Two bytes.
+ * @example
+ * ```typescript
+ * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
+ * assert(deserializer.deserializeU16() === 4660);
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU16(): Uint16 {
+ return new DataView(this.read(2)).getUint16(0, true);
+ }
+
+ /**
+ * Deserializes a uint32 number from a binary format in little-endian representation.
+ *
+ * BCS layout for "uint32": Four bytes.
+ * @example
+ * ```typescript
+ * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
+ * assert(deserializer.deserializeU32() === 305419896);
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU32(): Uint32 {
+ return new DataView(this.read(4)).getUint32(0, true);
+ }
+
+ /**
+ * Deserializes a uint64 number.
+ *
+ * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.
+ * @example
+ * ```typescript
+ * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
+ * assert(deserializer.deserializeU64() === 1311768467750121216);
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU64(): Uint64 {
+ const low = this.deserializeU32();
+ const high = this.deserializeU32();
+
+ // combine the two 32-bit values and return (little endian)
+ return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));
+ }
+
+ /**
+ * Deserializes a uint128 number from its binary representation.
+ * This function combines two 64-bit values to return a single uint128 value in little-endian format.
+ *
+ * @returns {BigInt} The deserialized uint128 number.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU128(): Uint128 {
+ const low = this.deserializeU64();
+ const high = this.deserializeU64();
+
+ // combine the two 64-bit values and return (little endian)
+ return BigInt((high << BigInt(64)) | low);
+ }
+
+ /**
+ * Deserializes a uint256 number from its binary representation.
+ *
+ * The BCS layout for "uint256" consists of thirty-two bytes in little-endian format.
+ *
+ * @returns {BigInt} The deserialized uint256 number.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeU256(): Uint256 {
+ const low = this.deserializeU128();
+ const high = this.deserializeU128();
+
+ // combine the two 128-bit values and return (little endian)
+ return BigInt((high << BigInt(128)) | low);
+ }
+
+ /**
+ * Deserializes a uleb128 encoded uint32 number.
+ *
+ * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.
+ *
+ * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.
+ * @returns {number} The deserialized uint32 value.
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeUleb128AsU32(): Uint32 {
+ let value: bigint = BigInt(0);
+ let shift = 0;
+
+ while (value < MAX_U32_NUMBER) {
+ const byte = this.deserializeU8();
+ value |= BigInt(byte & 0x7f) << BigInt(shift);
+
+ if ((byte & 0x80) === 0) {
+ break;
+ }
+ shift += 7;
+ }
+
+ if (value > MAX_U32_NUMBER) {
+ throw new Error("Overflow while parsing uleb128-encoded uint32 value");
+ }
+
+ return Number(value);
+ }
+
+ /**
+ * Helper function that primarily exists to support alternative syntax for deserialization.
+ * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
+ * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
+ *
+ * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
+ * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
+ * // value is now an instance of MyClass
+ * // equivalent to `const value = MyClass.deserialize(deserializer)`
+ * @param cls The BCS-deserializable class to deserialize the buffered bytes into.
+ *
+ * @returns the deserialized value of class type T
+ * @group Implementation
+ * @category BCS
+ */
+ deserialize(cls: Deserializable): T {
+ // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,
+ // It is separate from the `deserialize` instance method defined here in Deserializer.
+ return cls.deserialize(this);
+ }
+
+ /**
+ * Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.
+ *
+ * @param cls The BCS-deserializable class to deserialize the buffered bytes into.
+ * @returns An array of deserialized values of type T.
+ * @example
+ * // serialize a vector of addresses
+ * const addresses = new Array(
+ * AccountAddress.from("0x1"),
+ * AccountAddress.from("0x2"),
+ * AccountAddress.from("0xa"),
+ * AccountAddress.from("0xb"),
+ * );
+ * const serializer = new Serializer();
+ * serializer.serializeVector(addresses);
+ * const serializedBytes = serializer.toUint8Array();
+ *
+ * // deserialize the bytes into an array of addresses
+ * const deserializer = new Deserializer(serializedBytes);
+ * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
+ * // deserializedAddresses is now an array of AccountAddress instances
+ * @group Implementation
+ * @category BCS
+ */
+ deserializeVector(cls: Deserializable): Array {
+ const length = this.deserializeUleb128AsU32();
+ const vector = new Array();
+ for (let i = 0; i < length; i += 1) {
+ vector.push(this.deserialize(cls));
+ }
+ return vector;
+ }
+}
+
diff --git a/packages/bcs/src/index.ts b/packages/bcs/src/index.ts
new file mode 100644
index 000000000..efd99c05f
--- /dev/null
+++ b/packages/bcs/src/index.ts
@@ -0,0 +1,9 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+export * from "./deserializer";
+export * from "./serializer";
+export * from "./serializable";
+export * from "./types";
+
+
diff --git a/packages/bcs/src/serializable.ts b/packages/bcs/src/serializable.ts
new file mode 100644
index 000000000..23569e0ac
--- /dev/null
+++ b/packages/bcs/src/serializable.ts
@@ -0,0 +1,27 @@
+import { Deserializer } from "./deserializer"
+import { Serializable, SerializableMixins, WithSerializable } from "./serializer"
+
+export function defineBcsStruct<
+ T extends object,
+ C extends (...args: any[]) => T & Serializable
+>(fns: {
+ create: C
+ deserialize: (d: Deserializer) => ReturnType
+}) {
+ type Instance = WithSerializable
+ const wrap = (base: T & Serializable): Instance =>
+ Object.assign({} as Instance, base, SerializableMixins)
+
+ return {
+ create(...args: Parameters): Instance {
+ return wrap(fns.create(...args))
+ },
+ deserialize(d: Deserializer): Instance {
+ return wrap(fns.deserialize(d))
+ },
+ fromBytes(bytes: Uint8Array): Instance {
+ const d = new Deserializer(bytes)
+ return this.deserialize(d)
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/bcs/src/serializer.ts b/packages/bcs/src/serializer.ts
new file mode 100644
index 000000000..4068f49ce
--- /dev/null
+++ b/packages/bcs/src/serializer.ts
@@ -0,0 +1,513 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+/* eslint-disable no-bitwise */
+import { hexInputToString, hexInputToStringWithoutPrefix } from "@aptos-labs/utils";
+import {
+ MAX_U128_BIG_INT,
+ MAX_U16_NUMBER,
+ MAX_U32_NUMBER,
+ MAX_U64_BIG_INT,
+ MAX_U8_NUMBER,
+ MAX_U256_BIG_INT,
+} from "./consts";
+import type { AnyNumber, Uint16, Uint32, Uint8 } from "./types";
+
+export interface Serializable {
+ serialize(serializer: Serializer): void
+}
+
+export interface SerializableOps {
+ bcsToBytes(): Uint8Array
+ bcsToHex(): string
+ toStringWithoutPrefix(): string
+ toString(): string
+}
+
+export type WithSerializable = T & Serializable & SerializableOps
+
+export const SerializableMixins: SerializableOps = Object.freeze({
+ bcsToBytes(this: Serializable): Uint8Array {
+ const serializer = new Serializer()
+ this.serialize(serializer)
+ return serializer.toUint8Array()
+ },
+
+ bcsToHex(this: SerializableOps): string {
+ return hexInputToString(this.bcsToBytes())
+ },
+
+ toStringWithoutPrefix(this: SerializableOps): string {
+ return hexInputToStringWithoutPrefix(this.bcsToBytes())
+ },
+
+ toString(this: SerializableOps): string {
+ return this.bcsToHex()
+ }
+})
+
+/**
+ * A class for serializing various data types into a binary format.
+ * It provides methods to serialize strings, bytes, numbers, and other serializable objects
+ * using the Binary Coded Serialization (BCS) layout. The serialized data can be retrieved as a
+ * Uint8Array.
+ * @group Implementation
+ * @category BCS
+ */
+export class Serializer {
+ private buffer: ArrayBuffer;
+
+ private offset: number;
+
+ /**
+ * Constructs a serializer with a buffer of size `length` bytes, 64 bytes by default.
+ * The `length` must be greater than 0.
+ *
+ * @param length - The size of the buffer in bytes.
+ * @group Implementation
+ * @category BCS
+ */
+ constructor(length: number = 64) {
+ if (length <= 0) {
+ throw new Error("Length needs to be greater than 0");
+ }
+ this.buffer = new ArrayBuffer(length);
+ this.offset = 0;
+ }
+
+ /**
+ * Ensures that the internal buffer can accommodate the specified number of bytes.
+ * This function dynamically resizes the buffer if the current size is insufficient.
+ *
+ * @param bytes - The number of bytes to ensure the buffer can handle.
+ * @group Implementation
+ * @category BCS
+ */
+ private ensureBufferWillHandleSize(bytes: number) {
+ while (this.buffer.byteLength < this.offset + bytes) {
+ const newBuffer = new ArrayBuffer(this.buffer.byteLength * 2);
+ new Uint8Array(newBuffer).set(new Uint8Array(this.buffer));
+ this.buffer = newBuffer;
+ }
+ }
+
+ /**
+ * Appends the specified values to the buffer, ensuring that the buffer can accommodate the new data.
+ *
+ * @param {Uint8Array} values - The values to be appended to the buffer.
+ * @group Implementation
+ * @category BCS
+ */
+ protected appendToBuffer(values: Uint8Array) {
+ this.ensureBufferWillHandleSize(values.length);
+ new Uint8Array(this.buffer, this.offset).set(values);
+ this.offset += values.length;
+ }
+
+ /**
+ * Serializes a value into the buffer using the provided function, ensuring the buffer can accommodate the size.
+ *
+ * @param fn - The function to serialize the value, which takes a byte offset, the value to serialize, and an optional little-endian flag.
+ * @param fn.byteOffset - The byte offset at which to write the value.
+ * @param fn.value - The numeric value to serialize into the buffer.
+ * @param fn.littleEndian - Optional flag indicating whether to use little-endian byte order (defaults to true).
+ * @group Implementation
+ * @category BCS
+ */
+ // TODO: JSDoc bytesLength and value
+ private serializeWithFunction(
+ fn: (byteOffset: number, value: number, littleEndian?: boolean) => void,
+ bytesLength: number,
+ value: number,
+ ) {
+ this.ensureBufferWillHandleSize(bytesLength);
+ const dv = new DataView(this.buffer, this.offset);
+ fn.apply(dv, [0, value, true]);
+ this.offset += bytesLength;
+ }
+
+ /**
+ * Serializes a string. UTF8 string is supported.
+ * The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer.
+ * Then the string content is serialized as UTF8 encoded bytes.
+ *
+ * BCS layout for "string": string_length | string_content
+ * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
+ *
+ * @param value - The string to serialize.
+ *
+ * @example
+ * ```typescript
+ * const serializer = new Serializer();
+ * serializer.serializeStr("1234abcd");
+ * assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ serializeStr(value: string) {
+ const textEncoder = new TextEncoder();
+ this.serializeBytes(textEncoder.encode(value));
+ }
+
+ /**
+ * Serializes an array of bytes.
+ *
+ * This function encodes the length of the byte array as a u32 integer in uleb128 format, followed by the byte array itself.
+ * BCS layout for "bytes": bytes_length | bytes
+ * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
+ * @param value - The byte array to serialize.
+ * @group Implementation
+ * @category BCS
+ */
+ serializeBytes(value: Uint8Array) {
+ this.serializeU32AsUleb128(value.length);
+ this.appendToBuffer(value);
+ }
+
+ /**
+ * Serializes an array of bytes with a known length, allowing for efficient deserialization without needing to serialize the
+ * length itself.
+ * When deserializing, the number of bytes to deserialize needs to be passed in.
+ *
+ * @param value - The Uint8Array to be serialized.
+ * @group Implementation
+ * @category BCS
+ */
+ serializeFixedBytes(value: Uint8Array) {
+ this.appendToBuffer(value);
+ }
+
+ /**
+ * Serializes a boolean value into a byte representation.
+ *
+ * The BCS layout for a boolean uses one byte, where "0x01" represents true and "0x00" represents false.
+ *
+ * @param value - The boolean value to serialize.
+ * @group Implementation
+ * @category BCS
+ */
+ serializeBool(value: boolean) {
+ /**
+ * Ensures that the provided value is a boolean.
+ * This function throws an error if the value is not a boolean, helping to enforce type safety in your code.
+ *
+ * @param value - The value to be checked for boolean type.
+ * @throws {Error} Throws an error if the value is not a boolean.
+ * @group Implementation
+ * @category BCS
+ */
+ ensureBoolean(value);
+ const byteValue = value ? 1 : 0;
+ this.appendToBuffer(new Uint8Array([byteValue]));
+ }
+
+ /**
+ * Serializes a Uint8 value and appends it to the buffer.
+ * BCS layout for "uint8": One byte. Binary format in little-endian representation.
+ *
+ * @param value - The Uint8 value to serialize.
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(0, MAX_U8_NUMBER)
+ serializeU8(value: Uint8) {
+ this.appendToBuffer(new Uint8Array([value]));
+ }
+
+ /**
+ * Serializes a uint16 number.
+ *
+ * @group Implementation
+ * @category BCS
+ *
+ */
+
+ /**
+ * Serializes a 16-bit unsigned integer value into a binary format.
+ * BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
+ *
+ * @param value - The 16-bit unsigned integer value to serialize.
+ * @example
+ * ```typescript
+ * const serializer = new Serializer();
+ * serializer.serializeU16(4660);
+ * assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12]));
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(0, MAX_U16_NUMBER)
+ serializeU16(value: Uint16) {
+ this.serializeWithFunction(DataView.prototype.setUint16, 2, value);
+ }
+
+ /**
+ * Serializes a 32-bit unsigned integer value into a binary format.
+ * This function is useful for encoding data that needs to be stored or transmitted in a compact form.
+ * @example
+ * ```typescript
+ * const serializer = new Serializer();
+ * serializer.serializeU32(305419896);
+ * assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12]));
+ * ```
+ * @param value - The 32-bit unsigned integer value to serialize.
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(0, MAX_U32_NUMBER)
+ serializeU32(value: Uint32) {
+ this.serializeWithFunction(DataView.prototype.setUint32, 4, value);
+ }
+
+ /**
+ * Serializes a 64-bit unsigned integer into a format suitable for storage or transmission.
+ * This function breaks down the value into two 32-bit components and writes them in little-endian order.
+ *
+ * @param value - The 64-bit unsigned integer to serialize, represented as a number.
+ * @example
+ * ```ts
+ * const serializer = new Serializer();
+ * serializer.serializeU64(1311768467750121216);
+ * assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(BigInt(0), MAX_U64_BIG_INT)
+ serializeU64(value: AnyNumber) {
+ const low = BigInt(value) & BigInt(MAX_U32_NUMBER);
+ const high = BigInt(value) >> BigInt(32);
+
+ // write little endian number
+ this.serializeU32(Number(low));
+ this.serializeU32(Number(high));
+ }
+
+ /**
+ * Serializes a U128 value into a format suitable for storage or transmission.
+ *
+ * @param value - The U128 value to serialize, represented as a number.
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(BigInt(0), MAX_U128_BIG_INT)
+ serializeU128(value: AnyNumber) {
+ const low = BigInt(value) & MAX_U64_BIG_INT;
+ const high = BigInt(value) >> BigInt(64);
+
+ // write little endian number
+ this.serializeU64(low);
+ this.serializeU64(high);
+ }
+
+ /**
+ * Serializes a U256 value into a byte representation.
+ * This function is essential for encoding large numbers in a compact format suitable for transmission or storage.
+ *
+ * @param value - The U256 value to serialize, represented as an AnyNumber.
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(BigInt(0), MAX_U256_BIG_INT)
+ serializeU256(value: AnyNumber) {
+ const low = BigInt(value) & MAX_U128_BIG_INT;
+ const high = BigInt(value) >> BigInt(128);
+
+ // write little endian number
+ this.serializeU128(low);
+ this.serializeU128(high);
+ }
+
+ /**
+ * Serializes a 32-bit unsigned integer as a variable-length ULEB128 encoded byte array.
+ * BCS uses uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
+ *
+ * @param val - The 32-bit unsigned integer value to be serialized.
+ * @group Implementation
+ * @category BCS
+ */
+ @checkNumberRange(0, MAX_U32_NUMBER)
+ serializeU32AsUleb128(val: Uint32) {
+ let value = val;
+ const valueArray = [];
+ while (value >>> 7 !== 0) {
+ valueArray.push((value & 0x7f) | 0x80);
+ value >>>= 7;
+ }
+ valueArray.push(value);
+ this.appendToBuffer(new Uint8Array(valueArray));
+ }
+
+ /**
+ * Returns the buffered bytes as a Uint8Array.
+ *
+ * This function allows you to retrieve the byte representation of the buffer up to the current offset.
+ *
+ * @returns Uint8Array - The byte array representation of the buffer.
+ * @group Implementation
+ * @category BCS
+ */
+ toUint8Array(): Uint8Array {
+ return new Uint8Array(this.buffer).slice(0, this.offset);
+ }
+
+ /**
+ * Serializes a `Serializable` value, facilitating composable serialization.
+ *
+ * @param value The Serializable value to serialize.
+ *
+ * @returns the serializer instance
+ * @group Implementation
+ * @category BCS
+ */
+ serialize(value: T): void {
+ // NOTE: The `serialize` method called by `value` is defined in `value`'s
+ // Serializable interface, not the one defined in this class.
+ value.serialize(this);
+ }
+
+ /**
+ * Serializes an array of BCS Serializable values to a serializer instance.
+ * The bytes are added to the serializer instance's byte buffer.
+ *
+ * @param values The array of BCS Serializable values
+ * @example
+ * const addresses = new Array(
+ * AccountAddress.from("0x1"),
+ * AccountAddress.from("0x2"),
+ * AccountAddress.from("0xa"),
+ * AccountAddress.from("0xb"),
+ * );
+ * const serializer = new Serializer();
+ * serializer.serializeVector(addresses);
+ * const serializedBytes = serializer.toUint8Array();
+ * // serializedBytes is now the BCS-serialized bytes
+ * // The equivalent value in Move would be:
+ * // `bcs::to_bytes(&vector [@0x1, @0x2, @0xa, @0xb])`;
+ * @group Implementation
+ * @category BCS
+ */
+ serializeVector(values: Array): void {
+ this.serializeU32AsUleb128(values.length);
+ values.forEach((item) => {
+ item.serialize(this);
+ });
+ }
+
+ /**
+ * Serializes an optional value which can be a Serializable, string, or Uint8Array.
+ * For strings and Uint8Arrays, it uses the appropriate serialization method.
+ *
+ * @param value The value to serialize (Serializable, string, Uint8Array, or undefined)
+ * @param len Optional fixed length for Uint8Array serialization. If provided, uses serializeFixedBytes instead of serializeBytes
+ *
+ * @example
+ * ```typescript
+ * const serializer = new Serializer();
+ * serializer.serializeOption("hello"); // Serializes optional string
+ * serializer.serializeOption(new Uint8Array([1, 2, 3])); // Serializes optional bytes
+ * serializer.serializeOption(new Uint8Array([1, 2, 3]), 3); // Serializes optional fixed-length bytes
+ * serializer.serializeOption(new AccountAddress(...)); // Serializes optional Serializable
+ * serializer.serializeOption(undefined); // Serializes none case
+ * ```
+ * @group Implementation
+ * @category BCS
+ */
+ serializeOption(value?: T, len?: number): void {
+ const hasValue = value !== undefined;
+ this.serializeBool(hasValue);
+ if (hasValue) {
+ if (typeof value === "string") {
+ this.serializeStr(value);
+ } else if (value instanceof Uint8Array) {
+ if (len !== undefined) {
+ this.serializeFixedBytes(value);
+ } else {
+ this.serializeBytes(value);
+ }
+ } else {
+ value.serialize(this);
+ }
+ }
+ }
+
+ /**
+ * @deprecated use `serializeOption` instead.
+ * Serializes an optional string, supporting UTF8 encoding.
+ * The function encodes the existence of the string first, followed by the length and content if it exists.
+ *
+ * BCS layout for optional "string": 1 | string_length | string_content
+ * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
+ * BCS layout for undefined: 0
+ *
+ * @param value - The optional string to serialize. If undefined, it will serialize as 0.
+ * @group Implementation
+ * @category BCS
+ */
+ serializeOptionStr(value?: string): void {
+ if (value === undefined) {
+ this.serializeU32AsUleb128(0);
+ } else {
+ this.serializeU32AsUleb128(1);
+ this.serializeStr(value);
+ }
+ }
+}
+
+/**
+ * @group Implementation
+ * @category BCS
+ */
+export function ensureBoolean(value: unknown): asserts value is boolean {
+ if (typeof value !== "boolean") {
+ throw new Error(`${value} is not a boolean value`);
+ }
+}
+/**
+ * @group Implementation
+ * @category BCS
+ */
+export const outOfRangeErrorMessage = (value: AnyNumber, min: AnyNumber, max: AnyNumber) =>
+ `${value} is out of range: [${min}, ${max}]`;
+
+/**
+ * Validates that a given number is within a specified range.
+ * This function throws an error if the value is outside the defined minimum and maximum bounds.
+ *
+ * @param value - The number to validate.
+ * @param minValue - The minimum allowable value (inclusive).
+ * @param maxValue - The maximum allowable value (inclusive).
+ * @group Implementation
+ * @category BCS
+ */
+export function validateNumberInRange(value: T, minValue: T, maxValue: T) {
+ const valueBigInt = BigInt(value);
+ if (valueBigInt > BigInt(maxValue) || valueBigInt < BigInt(minValue)) {
+ throw new Error(outOfRangeErrorMessage(value, minValue, maxValue));
+ }
+}
+
+/**
+ * A decorator that validates that the input argument for a function is within a specified range.
+ * This ensures that the function is only called with valid input values, preventing potential errors.
+ *
+ * @param minValue - The input argument must be greater than or equal to this value.
+ * @param maxValue - The input argument must be less than or equal to this value.
+ * @group Implementation
+ * @category BCS
+ */
+function checkNumberRange(minValue: T, maxValue: T) {
+ return (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) => {
+ const childFunction = descriptor.value;
+ // eslint-disable-next-line no-param-reassign
+ descriptor.value = function deco(value: AnyNumber) {
+ validateNumberInRange(value, minValue, maxValue);
+ return childFunction.apply(this, [value]);
+ };
+
+ return descriptor;
+ };
+}
+
+
diff --git a/packages/bcs/src/types.ts b/packages/bcs/src/types.ts
new file mode 100644
index 000000000..78ba06f9c
--- /dev/null
+++ b/packages/bcs/src/types.ts
@@ -0,0 +1,39 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * Variants of script transaction arguments used in Rust, encompassing various data types for transaction processing.
+ * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}
+ */
+export enum ScriptTransactionArgumentVariants {
+ U8 = 0,
+ U64 = 1,
+ U128 = 2,
+ Address = 3,
+ U8Vector = 4,
+ Bool = 5,
+ U16 = 6,
+ U32 = 7,
+ U256 = 8,
+ Serialized = 9,
+}
+
+/**
+ * Type definitions for unsigned integers
+ */
+export type Uint8 = number;
+export type Uint16 = number;
+export type Uint32 = number;
+export type Uint64 = bigint;
+export type Uint128 = bigint;
+export type Uint256 = bigint;
+
+/**
+ * Any number type that can be used in BCS serialization
+ */
+export type AnyNumber = number | bigint;
+
+
+
+
+
diff --git a/packages/bcs/tsconfig.json b/packages/bcs/tsconfig.json
new file mode 100644
index 000000000..adc81c7ae
--- /dev/null
+++ b/packages/bcs/tsconfig.json
@@ -0,0 +1,49 @@
+{
+ "compilerOptions": {
+ // Language and Environment
+ "target": "ES2020",
+ "lib": ["ES2020", "DOM"],
+
+ // Modules
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "moduleDetection": "force",
+
+ // Interop Constraints
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "isolatedModules": true,
+
+ // Type Checking
+ "strict": true,
+ "noImplicitAny": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "strictBindCallApply": true,
+ "strictPropertyInitialization": true,
+ "noImplicitThis": true,
+ "alwaysStrict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+
+ // Emit
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "./dist",
+
+ // Advanced
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src/**/*", "../core/src/AccountAddress.ts"],
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
+}
+
+
diff --git a/packages/bcs/tsup.config.ts b/packages/bcs/tsup.config.ts
new file mode 100644
index 000000000..4eebefff3
--- /dev/null
+++ b/packages/bcs/tsup.config.ts
@@ -0,0 +1,45 @@
+import { defineConfig } from "tsup";
+import type { Options, Format } from "tsup";
+
+// Ensure that these option fields are not undefined
+type MandatoryOptions = Options & {
+ outDir: string;
+ format: Format | Format[];
+};
+
+// Default config, used as a base template
+const DEFAULT_CONFIG: Options = {
+ bundle: true,
+ clean: true, // clean up the dist folder
+ dts: true, // generate dts files
+ minify: false, // don't minify for better debugging
+ entry: ["src/index.ts"], // entry point
+ skipNodeModulesBundle: true,
+ sourcemap: true,
+ splitting: false, // disable code splitting for library
+ target: "es2020",
+ treeshake: true,
+};
+
+// Common.js config for Node.js
+const CJS_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "cjs",
+ outDir: "dist/cjs",
+ platform: "node",
+};
+
+// ESM config for modern Node.js and bundlers
+const ESM_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "esm",
+ outDir: "dist/esm",
+ platform: "neutral", // works in both browser and node
+};
+
+export default defineConfig([CJS_CONFIG, ESM_CONFIG]);
+
+
+
+
+
diff --git a/packages/core/package.json b/packages/core/package.json
new file mode 100644
index 000000000..ab291bb31
--- /dev/null
+++ b/packages/core/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@aptos-labs/core",
+ "version": "1.0.0",
+ "description": "Core library for Aptos TypeScript SDK",
+ "main": "./dist/cjs/index.js",
+ "module": "./dist/esm/index.mjs",
+ "types": "./dist/esm/index.d.mts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.mts",
+ "default": "./dist/esm/index.mjs"
+ },
+ "require": {
+ "types": "./dist/cjs/index.d.ts",
+ "default": "./dist/cjs/index.js"
+ }
+ }
+ },
+ "files": [
+ "dist",
+ "package.json"
+ ],
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "aptos",
+ "core",
+ "sdk"
+ ],
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@aptos-labs/utils": "workspace:*",
+ "@aptos-labs/bcs": "workspace:*"
+ },
+ "devDependencies": {
+ "tsup": "^8.5.0",
+ "typescript": "^5.8.3"
+ }
+}
+
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
new file mode 100644
index 000000000..9bbf96eca
--- /dev/null
+++ b/packages/core/src/index.ts
@@ -0,0 +1,6 @@
+/**
+ * @aptos-labs/core
+ * Core library for Aptos TypeScript SDK
+ */
+
+export * from "./primitives/index";
diff --git a/packages/core/src/primitives/AccountAddress.ts b/packages/core/src/primitives/AccountAddress.ts
new file mode 100644
index 000000000..d60c1a6e4
--- /dev/null
+++ b/packages/core/src/primitives/AccountAddress.ts
@@ -0,0 +1,30 @@
+import { defineBcsStruct } from '@aptos-labs/bcs';
+import type { Serializer, WithSerializable } from '@aptos-labs/bcs';
+import type { Deserializer } from '@aptos-labs/bcs';
+import { HexInput, hexInputToUint8Array } from '@aptos-labs/utils';
+
+type AccountAddressData = {
+ bytes: Uint8Array
+}
+
+export type AccountAddress = WithSerializable
+export const AccountAddress = defineBcsStruct({
+ create(hex_input: HexInput) {
+ const bytes = hexInputToUint8Array(hex_input)
+ return {
+ bytes,
+ serialize(s: Serializer) {
+ s.serializeFixedBytes(bytes)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const bytes = d.deserializeFixedBytes(32)
+ return {
+ bytes,
+ serialize(s: Serializer) {
+ s.serializeFixedBytes(bytes)
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/packages/core/src/primitives/Bool.ts b/packages/core/src/primitives/Bool.ts
new file mode 100644
index 000000000..91ba24384
--- /dev/null
+++ b/packages/core/src/primitives/Bool.ts
@@ -0,0 +1,27 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable } from '@aptos-labs/bcs';
+
+type BoolData = {
+ value: boolean
+}
+
+export type Bool = WithSerializable
+export const Bool = defineBcsStruct({
+ create(value: boolean) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeBool(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeBool()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeBool(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/MoveString.ts b/packages/core/src/primitives/MoveString.ts
new file mode 100644
index 000000000..34ab25afb
--- /dev/null
+++ b/packages/core/src/primitives/MoveString.ts
@@ -0,0 +1,27 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable } from '@aptos-labs/bcs';
+
+type MoveStringData = {
+ value: string
+}
+
+export type MoveString = WithSerializable
+export const MoveString = defineBcsStruct({
+ create(value: string) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeStr(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeStr()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeStr(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/Option.ts b/packages/core/src/primitives/Option.ts
new file mode 100644
index 000000000..243273ef2
--- /dev/null
+++ b/packages/core/src/primitives/Option.ts
@@ -0,0 +1,35 @@
+import { defineBcsStruct, Deserializer, Deserializable, Serializer, WithSerializable, Serializable } from '@aptos-labs/bcs';
+
+type OptionData = {
+ value: T | undefined
+}
+
+export type Option = WithSerializable>
+
+type OptionType = Deserializable
+
+export function Option(
+ type: OptionType,
+) {
+ return defineBcsStruct, (value?: T) => OptionData & Serializable>({
+ create(value?: T) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeOption(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ let value: T | undefined
+ value = d.deserializeOption(type)
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeOption(value)
+ }
+ }
+ }
+ })
+}
+
diff --git a/packages/core/src/primitives/U128.ts b/packages/core/src/primitives/U128.ts
new file mode 100644
index 000000000..cef1c3e89
--- /dev/null
+++ b/packages/core/src/primitives/U128.ts
@@ -0,0 +1,28 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable, AnyNumber } from '@aptos-labs/bcs';
+
+type U128Data = {
+ value: bigint
+}
+
+export type U128 = WithSerializable
+export const U128 = defineBcsStruct({
+ create(value: AnyNumber) {
+ const bigIntValue = BigInt(value)
+ return {
+ value: bigIntValue,
+ serialize(s: Serializer) {
+ s.serializeU128(bigIntValue)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU128()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU128(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/U16.ts b/packages/core/src/primitives/U16.ts
new file mode 100644
index 000000000..d6816eade
--- /dev/null
+++ b/packages/core/src/primitives/U16.ts
@@ -0,0 +1,27 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable } from '@aptos-labs/bcs';
+
+type U16Data = {
+ value: number
+}
+
+export type U16 = WithSerializable
+export const U16 = defineBcsStruct({
+ create(value: number) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU16(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU16()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU16(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/U256.ts b/packages/core/src/primitives/U256.ts
new file mode 100644
index 000000000..f64a4d27b
--- /dev/null
+++ b/packages/core/src/primitives/U256.ts
@@ -0,0 +1,28 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable, AnyNumber } from '@aptos-labs/bcs';
+
+type U256Data = {
+ value: bigint
+}
+
+export type U256 = WithSerializable
+export const U256 = defineBcsStruct({
+ create(value: AnyNumber) {
+ const bigIntValue = BigInt(value)
+ return {
+ value: bigIntValue,
+ serialize(s: Serializer) {
+ s.serializeU256(bigIntValue)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU256()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU256(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/U32.ts b/packages/core/src/primitives/U32.ts
new file mode 100644
index 000000000..64db5b699
--- /dev/null
+++ b/packages/core/src/primitives/U32.ts
@@ -0,0 +1,27 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable } from '@aptos-labs/bcs';
+
+type U32Data = {
+ value: number
+}
+
+export type U32 = WithSerializable
+export const U32 = defineBcsStruct({
+ create(value: number) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU32(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU32()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU32(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/U64.ts b/packages/core/src/primitives/U64.ts
new file mode 100644
index 000000000..8f93b53a5
--- /dev/null
+++ b/packages/core/src/primitives/U64.ts
@@ -0,0 +1,28 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable, AnyNumber } from '@aptos-labs/bcs';
+
+type U64Data = {
+ value: bigint
+}
+
+export type U64 = WithSerializable
+export const U64 = defineBcsStruct({
+ create(value: AnyNumber) {
+ const bigIntValue = BigInt(value)
+ return {
+ value: bigIntValue,
+ serialize(s: Serializer) {
+ s.serializeU64(bigIntValue)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU64()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU64(value)
+ }
+ }
+ }
+})
+
diff --git a/packages/core/src/primitives/U8.ts b/packages/core/src/primitives/U8.ts
new file mode 100644
index 000000000..a248c9835
--- /dev/null
+++ b/packages/core/src/primitives/U8.ts
@@ -0,0 +1,26 @@
+import { defineBcsStruct, Deserializer, Serializer, WithSerializable } from '@aptos-labs/bcs';
+
+type U8Data = {
+ value: number
+}
+
+export type U8 = WithSerializable
+export const U8 = defineBcsStruct({
+ create(value: number) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU8(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeU8()
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeU8(value)
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/packages/core/src/primitives/Vector.ts b/packages/core/src/primitives/Vector.ts
new file mode 100644
index 000000000..e5a273e40
--- /dev/null
+++ b/packages/core/src/primitives/Vector.ts
@@ -0,0 +1,30 @@
+import { defineBcsStruct, Deserializer, Deserializable, Serializer, WithSerializable, Serializable } from '@aptos-labs/bcs';
+
+type VectorData = {
+ value: Array
+}
+
+export type Vector = WithSerializable>
+
+export function Vector(cls: Deserializable) {
+ return defineBcsStruct, (value: Array) => VectorData & Serializable>({
+ create(value: Array) {
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeVector(value)
+ }
+ }
+ },
+ deserialize(d: Deserializer) {
+ const value = d.deserializeVector(cls)
+ return {
+ value,
+ serialize(s: Serializer) {
+ s.serializeVector(value)
+ }
+ }
+ }
+ })
+}
+
diff --git a/packages/core/src/primitives/index.ts b/packages/core/src/primitives/index.ts
new file mode 100644
index 000000000..8fa8603f6
--- /dev/null
+++ b/packages/core/src/primitives/index.ts
@@ -0,0 +1,11 @@
+export * from "./AccountAddress";
+export * from "./Bool";
+export * from "./U8";
+export * from "./U16";
+export * from "./U32";
+export * from "./U64";
+export * from "./U128";
+export * from "./U256";
+export * from "./MoveString";
+export * from "./Vector";
+export * from "./Option";
\ No newline at end of file
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
new file mode 100644
index 000000000..282bc0212
--- /dev/null
+++ b/packages/core/tsconfig.json
@@ -0,0 +1,49 @@
+{
+ "compilerOptions": {
+ // Language and Environment
+ "target": "ES2020",
+ "lib": ["ES2020", "DOM"],
+
+ // Modules
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "moduleDetection": "force",
+
+ // Interop Constraints
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "isolatedModules": true,
+
+ // Type Checking
+ "strict": true,
+ "noImplicitAny": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "strictBindCallApply": true,
+ "strictPropertyInitialization": true,
+ "noImplicitThis": true,
+ "alwaysStrict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+
+ // Emit
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "./dist",
+
+ // Advanced
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
+}
+
+
diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts
new file mode 100644
index 000000000..9b5c48e16
--- /dev/null
+++ b/packages/core/tsup.config.ts
@@ -0,0 +1,42 @@
+import { defineConfig } from "tsup";
+import type { Options, Format } from "tsup";
+
+// Ensure that these option fields are not undefined
+type MandatoryOptions = Options & {
+ outDir: string;
+ format: Format | Format[];
+};
+
+// Default config, used as a base template
+const DEFAULT_CONFIG: Options = {
+ bundle: true,
+ clean: true, // clean up the dist folder
+ dts: true, // generate dts files
+ minify: false, // don't minify for better debugging
+ entry: ["src/index.ts"], // entry point
+ skipNodeModulesBundle: true,
+ sourcemap: true,
+ splitting: false, // disable code splitting for library
+ target: "es2020",
+ treeshake: true,
+};
+
+// Common.js config for Node.js
+const CJS_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "cjs",
+ outDir: "dist/cjs",
+ platform: "node",
+};
+
+// ESM config for modern Node.js and bundlers
+const ESM_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "esm",
+ outDir: "dist/esm",
+ platform: "neutral", // works in both browser and node
+};
+
+export default defineConfig([CJS_CONFIG, ESM_CONFIG]);
+
+
diff --git a/packages/utils/package.json b/packages/utils/package.json
new file mode 100644
index 000000000..fc6e45e66
--- /dev/null
+++ b/packages/utils/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "@aptos-labs/utils",
+ "version": "1.0.0",
+ "description": "",
+ "main": "./dist/cjs/index.js",
+ "module": "./dist/esm/index.mjs",
+ "types": "./dist/esm/index.d.mts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.mts",
+ "default": "./dist/esm/index.mjs"
+ },
+ "require": {
+ "types": "./dist/cjs/index.d.ts",
+ "default": "./dist/cjs/index.js"
+ }
+ }
+ },
+ "files": [
+ "dist",
+ "package.json"
+ ],
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "@noble/hashes": "^1.5.0"
+ },
+ "devDependencies": {
+ "tsup": "^8.5.0"
+ }
+}
diff --git a/packages/utils/src/hex.ts b/packages/utils/src/hex.ts
new file mode 100644
index 000000000..21be5bf39
--- /dev/null
+++ b/packages/utils/src/hex.ts
@@ -0,0 +1,235 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
+import { ParsingError, ParsingResult } from "./parsing";
+
+/**
+ * HexInput can be a string (with or without 0x prefix) or a Uint8Array.
+ */
+export type HexInput = string | Uint8Array;
+
+/**
+ * Provides reasons for parsing failures related to hexadecimal values.
+ */
+export enum HexInvalidReason {
+ TOO_SHORT = "too_short",
+ INVALID_LENGTH = "invalid_length",
+ INVALID_HEX_CHARS = "invalid_hex_chars",
+}
+
+// ===
+// Functions for converting hex strings to Uint8Array
+// ===
+
+/**
+ * Converts a hex string into a Uint8Array, allowing for both prefixed and non-prefixed formats.
+ *
+ * @param str - A hex string, with or without the 0x prefix.
+ *
+ * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.
+ *
+ * @returns Uint8Array - The resulting Uint8Array created from the provided string.
+ *
+ * @example
+ * ```typescript
+ * fromHexString("0x1f") // returns Uint8Array([0x1f])
+ * fromHexString("1f") // returns Uint8Array([0x1f])
+ * ```
+ */
+export function fromHexString(str: string): Uint8Array {
+ let input = str;
+
+ if (input.startsWith("0x")) {
+ input = input.slice(2);
+ }
+
+ if (input.length === 0) {
+ throw new ParsingError(
+ "Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.",
+ HexInvalidReason.TOO_SHORT,
+ );
+ }
+
+ if (input.length % 2 !== 0) {
+ throw new ParsingError("Hex string must be an even number of hex characters.", HexInvalidReason.INVALID_LENGTH);
+ }
+
+ try {
+ return hexToBytes(input);
+ } catch (error: any) {
+ throw new ParsingError(
+ `Hex string contains invalid hex characters: ${error?.message}`,
+ HexInvalidReason.INVALID_HEX_CHARS,
+ );
+ }
+}
+
+/**
+ * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.
+ * This function is useful for transforming hexadecimal representations into a Uint8Array for further manipulation.
+ *
+ * @param hexInput - A HexInput which can be a string or Uint8Array.
+ * @returns A Uint8Array created from the provided hexInput.
+ *
+ * @example
+ * ```typescript
+ * fromHexInput("0x1f") // returns Uint8Array([0x1f])
+ * fromHexInput(new Uint8Array([0x1f])) // returns Uint8Array([0x1f])
+ * ```
+ */
+export function fromHexInput(hexInput: HexInput): Uint8Array {
+ if (hexInput instanceof Uint8Array) return hexInput;
+ return fromHexString(hexInput);
+}
+
+// ===
+// Functions for converting Uint8Array to hex strings
+// ===
+
+/**
+ * Converts a Uint8Array to a hex string without the 0x prefix.
+ *
+ * @param data - The Uint8Array to convert.
+ * @returns Hex string without 0x prefix
+ *
+ * @example
+ * ```typescript
+ * toHexStringWithoutPrefix(new Uint8Array([0x1f])) // returns "1f"
+ * ```
+ */
+export function toHexStringWithoutPrefix(data: Uint8Array): string {
+ return bytesToHex(data);
+}
+
+/**
+ * Converts a Uint8Array to a hex string with the 0x prefix.
+ *
+ * @param data - The Uint8Array to convert.
+ * @returns Hex string with 0x prefix
+ *
+ * @example
+ * ```typescript
+ * toHexString(new Uint8Array([0x1f])) // returns "0x1f"
+ * ```
+ */
+export function toHexString(data: Uint8Array): string {
+ return `0x${toHexStringWithoutPrefix(data)}`;
+}
+
+// ===
+// Functions for converting HexInput to hex strings
+// ===
+
+/**
+ * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.
+ *
+ * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
+ * @returns A hex string with '0x' prefix (e.g., "0x1234")
+ *
+ * @example
+ * ```typescript
+ * hexInputToString("1234") // returns "0x1234"
+ * hexInputToString("0x1234") // returns "0x1234"
+ * hexInputToString(new Uint8Array([0x12, 0x34])) // returns "0x1234"
+ * ```
+ */
+export function hexInputToString(hexInput: HexInput): string {
+ return toHexString(fromHexInput(hexInput));
+}
+
+/**
+ * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.
+ *
+ * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
+ * @returns A hex string without '0x' prefix (e.g., "1234")
+ *
+ * @example
+ * ```typescript
+ * hexInputToStringWithoutPrefix("1234") // returns "1234"
+ * hexInputToStringWithoutPrefix("0x1234") // returns "1234"
+ * hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns "1234"
+ * ```
+ */
+export function hexInputToStringWithoutPrefix(hexInput: HexInput): string {
+ return toHexStringWithoutPrefix(fromHexInput(hexInput));
+}
+
+/**
+ * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.
+ * This is an alias for fromHexInput for consistency with the original class API.
+ *
+ * @param hexInput - A HexInput which can be a string or Uint8Array.
+ * @returns A Uint8Array created from the provided hexInput.
+ */
+export function hexInputToUint8Array(hexInput: HexInput): Uint8Array {
+ return fromHexInput(hexInput);
+}
+
+// ===
+// Functions for checking validity
+// ===
+
+/**
+ * Check if the provided string is a valid hexadecimal representation.
+ *
+ * @param str - A hex string representing byte data.
+ *
+ * @returns An object containing:
+ * - valid: A boolean indicating whether the string is valid.
+ * - invalidReason: The reason for invalidity if the string is not valid.
+ * - invalidReasonMessage: A message explaining why the string is invalid.
+ *
+ * @example
+ * ```typescript
+ * isValidHex("0x1f") // returns { valid: true }
+ * isValidHex("1g") // returns { valid: false, invalidReason: "invalid_hex_chars", ... }
+ * ```
+ */
+export function isValidHex(str: string): ParsingResult {
+ try {
+ fromHexString(str);
+ return { valid: true };
+ } catch (error: any) {
+ return {
+ valid: false,
+ invalidReason: error?.invalidReason,
+ invalidReasonMessage: error?.message,
+ };
+ }
+}
+
+/**
+ * Determine if two Uint8Arrays are equal by comparing their byte data.
+ *
+ * @param data1 - The first Uint8Array to compare.
+ * @param data2 - The second Uint8Array to compare.
+ * @returns true if the Uint8Arrays are equal, false if not.
+ *
+ * @example
+ * ```typescript
+ * equals(new Uint8Array([0x1f]), new Uint8Array([0x1f])) // returns true
+ * equals(new Uint8Array([0x1f]), new Uint8Array([0x20])) // returns false
+ * ```
+ */
+export function equals(data1: Uint8Array, data2: Uint8Array): boolean {
+ if (data1.length !== data2.length) return false;
+ return data1.every((value, index) => value === data2[index]);
+}
+
+/**
+ * Converts a hex string to an ASCII string.
+ *
+ * @param hex - A hex string (with or without 0x prefix) or Uint8Array.
+ * @returns The ASCII string representation of the hex data.
+ *
+ * @example
+ * ```typescript
+ * hexToAsciiString("0x48656c6c6f") // returns "Hello"
+ * ```
+ */
+export function hexToAsciiString(hex: HexInput): string {
+ return new TextDecoder().decode(fromHexInput(hex));
+}
+
+
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
new file mode 100644
index 000000000..1d2704a71
--- /dev/null
+++ b/packages/utils/src/index.ts
@@ -0,0 +1,25 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+// Export parsing utilities
+export { ParsingError } from "./parsing";
+export type { ParsingResult } from "./parsing";
+
+// Export all hex utility functions
+export {
+ HexInvalidReason,
+ fromHexString,
+ fromHexInput,
+ toHexStringWithoutPrefix,
+ toHexString,
+ hexInputToString,
+ hexInputToStringWithoutPrefix,
+ hexInputToUint8Array,
+ isValidHex,
+ equals,
+ hexToAsciiString,
+} from "./hex";
+
+// Export types separately for isolatedModules compatibility
+export type { HexInput } from "./hex";
+
diff --git a/packages/utils/src/parsing.ts b/packages/utils/src/parsing.ts
new file mode 100644
index 000000000..92cb3243c
--- /dev/null
+++ b/packages/utils/src/parsing.ts
@@ -0,0 +1,61 @@
+// Copyright © Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+/**
+ * This error is used to explain why parsing failed.
+ * @group Implementation
+ * @category Serialization
+ */
+export class ParsingError extends Error {
+ /**
+ * This provides a programmatic way to access why parsing failed. Downstream devs
+ * might want to use this to build their own error messages if the default error
+ * messages are not suitable for their use case. This should be an enum.
+ * @group Implementation
+ * @category Serialization
+ */
+ public invalidReason: T;
+
+ /**
+ * Creates an instance of the error with a specified message and invalid reason.
+ *
+ * @param message The error message that describes the issue.
+ * @param invalidReason The reason why the input is considered invalid.
+ * @group Implementation
+ * @category Serialization
+ */
+ constructor(message: string, invalidReason: T) {
+ super(message);
+ this.invalidReason = invalidReason;
+ }
+}
+
+/**
+ * Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
+ * this type is returned from "defensive" functions like isValid.
+ * @group Implementation
+ * @category Serialization
+ */
+export type ParsingResult = {
+ /**
+ * True if valid, false otherwise.
+ * @group Implementation
+ * @category Serialization
+ */
+ valid: boolean;
+
+ /**
+ * If valid is false, this will be a code explaining why parsing failed.
+ * @group Implementation
+ * @category Serialization
+ */
+ invalidReason?: T;
+
+ /**
+ * If valid is false, this will be a string explaining why parsing failed.
+ * @group Implementation
+ * @category Serialization
+ */
+ invalidReasonMessage?: string;
+};
+
diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json
new file mode 100644
index 000000000..16519668c
--- /dev/null
+++ b/packages/utils/tsconfig.json
@@ -0,0 +1,46 @@
+{
+ "compilerOptions": {
+ // Language and Environment
+ "target": "ES2020",
+ "lib": ["ES2020", "DOM"],
+
+ // Modules
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "moduleDetection": "force",
+
+ // Interop Constraints
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "isolatedModules": true,
+
+ // Type Checking
+ "strict": true,
+ "noImplicitAny": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "strictBindCallApply": true,
+ "strictPropertyInitialization": true,
+ "noImplicitThis": true,
+ "alwaysStrict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+
+ // Emit
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "./dist",
+
+ // Advanced
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
+}
+
diff --git a/packages/utils/tsup.config.ts b/packages/utils/tsup.config.ts
new file mode 100644
index 000000000..bef95f6a3
--- /dev/null
+++ b/packages/utils/tsup.config.ts
@@ -0,0 +1,51 @@
+import { defineConfig } from "tsup";
+import type { Options, Format } from "tsup";
+
+// Ensure that these option fields are not undefined
+type MandatoryOptions = Options & {
+ outDir: string;
+ format: Format | Format[];
+};
+
+// Default config, used as a base template
+const DEFAULT_CONFIG: Options = {
+ bundle: true,
+ clean: true, // clean up the dist folder
+ dts: true, // generate dts files
+ minify: false, // don't minify for better debugging
+ entry: ["src/index.ts"], // entry point
+ skipNodeModulesBundle: true,
+ sourcemap: true,
+ splitting: false, // disable code splitting for library
+ target: "es2020",
+ treeshake: true,
+};
+
+// Common.js config for Node.js
+const CJS_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "cjs",
+ outDir: "dist/cjs",
+ platform: "node",
+};
+
+// ESM config for modern Node.js and bundlers
+const ESM_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "esm",
+ outDir: "dist/esm",
+ platform: "neutral", // works in both browser and node
+};
+
+// IIFE config for browser (optional, if needed)
+const IIFE_CONFIG: MandatoryOptions = {
+ ...DEFAULT_CONFIG,
+ format: "iife",
+ outDir: "dist/iife",
+ platform: "browser",
+ globalName: "AptosUtils",
+ minify: true, // minify browser bundle
+};
+
+export default defineConfig([CJS_CONFIG, ESM_CONFIG]);
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d93f74bff..307e394f5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4,135 +4,179 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
-dependencies:
- '@aptos-labs/aptos-cli':
- specifier: ^1.0.2
- version: 1.0.2
- '@aptos-labs/aptos-client':
- specifier: ^2.0.0
- version: 2.0.0(got@11.8.6)
- '@noble/curves':
- specifier: ^1.9.0
- version: 1.9.0
- '@noble/hashes':
- specifier: ^1.5.0
- version: 1.8.0
- '@scure/bip32':
- specifier: ^1.4.0
- version: 1.7.0
- '@scure/bip39':
- specifier: ^1.3.0
- version: 1.6.0
- eventemitter3:
- specifier: ^5.0.1
- version: 5.0.1
- js-base64:
- specifier: ^3.7.7
- version: 3.7.7
- jwt-decode:
- specifier: ^4.0.0
- version: 4.0.0
- poseidon-lite:
- specifier: ^0.2.0
- version: 0.2.1
-
-devDependencies:
- '@babel/traverse':
- specifier: ^7.28.4
- version: 7.28.4
- '@cucumber/cucumber':
- specifier: ^12.2.0
- version: 12.2.0
- '@eslint/eslintrc':
- specifier: ^3.3.1
- version: 3.3.1
- '@graphql-codegen/cli':
- specifier: ^6.0.0
- version: 6.0.0(@types/node@24.3.1)(graphql@16.11.0)(typescript@5.8.3)
- '@graphql-codegen/import-types-preset':
- specifier: ^3.0.1
- version: 3.0.1(graphql@16.11.0)
- '@graphql-codegen/typescript':
- specifier: ^5.0.0
- version: 5.0.0(graphql@16.11.0)
- '@graphql-codegen/typescript-graphql-request':
- specifier: ^6.3.0
- version: 6.3.0(graphql-request@7.2.0)(graphql-tag@2.12.6)(graphql@16.11.0)
- '@graphql-codegen/typescript-operations':
- specifier: ^5.0.0
- version: 5.0.0(graphql@16.11.0)
- '@types/base-64':
- specifier: ^1.0.2
- version: 1.0.2
- '@types/jest':
- specifier: ^29.5.14
- version: 29.5.14
- '@types/jsonwebtoken':
- specifier: ^9.0.10
- version: 9.0.10
- '@types/node':
- specifier: ^24.3.1
- version: 24.3.1
- '@typescript-eslint/eslint-plugin':
- specifier: ^8.43.0
- version: 8.43.0(@typescript-eslint/parser@8.43.0)(eslint@9.35.0)(typescript@5.8.3)
- '@typescript-eslint/parser':
- specifier: ^8.43.0
- version: 8.43.0(eslint@9.35.0)(typescript@5.8.3)
- dotenv:
- specifier: ^16.4.7
- version: 16.5.0
- eslint:
- specifier: ^9.35.0
- version: 9.35.0
- eslint-config-airbnb-base:
- specifier: ^15.0.0
- version: 15.0.0(eslint-plugin-import@2.32.0)(eslint@9.35.0)
- eslint-config-prettier:
- specifier: ^10.1.8
- version: 10.1.8(eslint@9.35.0)
- eslint-plugin-import:
- specifier: ^2.32.0
- version: 2.32.0(@typescript-eslint/parser@8.43.0)(eslint@9.35.0)
- globals:
- specifier: ^16.4.0
- version: 16.4.0
- graphql:
- specifier: ^16.11.0
- version: 16.11.0
- graphql-request:
- specifier: ^7.2.0
- version: 7.2.0(graphql@16.11.0)
- jest:
- specifier: ^29.7.0
- version: 29.7.0(@types/node@24.3.1)
- jsonwebtoken:
- specifier: ^9.0.2
- version: 9.0.2
- prettier:
- specifier: ^3.6.2
- version: 3.6.2
- tree-kill:
- specifier: ^1.2.2
- version: 1.2.2
- ts-jest:
- specifier: ^29.4.1
- version: 29.4.1(@babel/core@7.28.4)(esbuild@0.25.3)(jest@29.7.0)(typescript@5.8.3)
- ts-loader:
- specifier: ^9.5.4
- version: 9.5.4(typescript@5.8.3)(webpack@5.99.7)
- tsup:
- specifier: ^8.5.0
- version: 8.5.0(typescript@5.8.3)
- typedoc:
- specifier: ^0.28.12
- version: 0.28.12(typescript@5.8.3)
- typedoc-plugin-missing-exports:
- specifier: ^4.1.0
- version: 4.1.0(typedoc@0.28.12)
- typescript:
- specifier: ^5.8.3
- version: 5.8.3
+importers:
+
+ .:
+ dependencies:
+ '@aptos-labs/aptos-cli':
+ specifier: ^1.0.2
+ version: 1.0.2
+ '@aptos-labs/aptos-client':
+ specifier: ^2.0.0
+ version: 2.0.0(got@11.8.6)
+ '@noble/curves':
+ specifier: ^1.9.0
+ version: 1.9.0
+ '@noble/hashes':
+ specifier: ^1.5.0
+ version: 1.8.0
+ '@scure/bip32':
+ specifier: ^1.4.0
+ version: 1.7.0
+ '@scure/bip39':
+ specifier: ^1.3.0
+ version: 1.6.0
+ eventemitter3:
+ specifier: ^5.0.1
+ version: 5.0.1
+ js-base64:
+ specifier: ^3.7.7
+ version: 3.7.7
+ jwt-decode:
+ specifier: ^4.0.0
+ version: 4.0.0
+ poseidon-lite:
+ specifier: ^0.2.0
+ version: 0.2.1
+ devDependencies:
+ '@babel/traverse':
+ specifier: ^7.28.4
+ version: 7.28.4
+ '@cucumber/cucumber':
+ specifier: ^12.2.0
+ version: 12.2.0
+ '@eslint/eslintrc':
+ specifier: ^3.3.1
+ version: 3.3.1
+ '@graphql-codegen/cli':
+ specifier: ^6.0.0
+ version: 6.0.0(@types/node@24.3.1)(graphql@16.11.0)(typescript@5.8.3)
+ '@graphql-codegen/import-types-preset':
+ specifier: ^3.0.1
+ version: 3.0.1(graphql@16.11.0)
+ '@graphql-codegen/typescript':
+ specifier: ^5.0.0
+ version: 5.0.0(graphql@16.11.0)
+ '@graphql-codegen/typescript-graphql-request':
+ specifier: ^6.3.0
+ version: 6.3.0(graphql-request@7.2.0)(graphql-tag@2.12.6)(graphql@16.11.0)
+ '@graphql-codegen/typescript-operations':
+ specifier: ^5.0.0
+ version: 5.0.0(graphql@16.11.0)
+ '@types/base-64':
+ specifier: ^1.0.2
+ version: 1.0.2
+ '@types/jest':
+ specifier: ^29.5.14
+ version: 29.5.14
+ '@types/jsonwebtoken':
+ specifier: ^9.0.10
+ version: 9.0.10
+ '@types/node':
+ specifier: ^24.3.1
+ version: 24.3.1
+ '@typescript-eslint/eslint-plugin':
+ specifier: ^8.43.0
+ version: 8.43.0(@typescript-eslint/parser@8.43.0)(eslint@9.35.0)(typescript@5.8.3)
+ '@typescript-eslint/parser':
+ specifier: ^8.43.0
+ version: 8.43.0(eslint@9.35.0)(typescript@5.8.3)
+ dotenv:
+ specifier: ^16.4.7
+ version: 16.5.0
+ eslint:
+ specifier: ^9.35.0
+ version: 9.35.0
+ eslint-config-airbnb-base:
+ specifier: ^15.0.0
+ version: 15.0.0(eslint-plugin-import@2.32.0)(eslint@9.35.0)
+ eslint-config-prettier:
+ specifier: ^10.1.8
+ version: 10.1.8(eslint@9.35.0)
+ eslint-plugin-import:
+ specifier: ^2.32.0
+ version: 2.32.0(@typescript-eslint/parser@8.43.0)(eslint@9.35.0)
+ globals:
+ specifier: ^16.4.0
+ version: 16.4.0
+ graphql:
+ specifier: ^16.11.0
+ version: 16.11.0
+ graphql-request:
+ specifier: ^7.2.0
+ version: 7.2.0(graphql@16.11.0)
+ jest:
+ specifier: ^29.7.0
+ version: 29.7.0(@types/node@24.3.1)
+ jsonwebtoken:
+ specifier: ^9.0.2
+ version: 9.0.2
+ prettier:
+ specifier: ^3.6.2
+ version: 3.6.2
+ tree-kill:
+ specifier: ^1.2.2
+ version: 1.2.2
+ ts-jest:
+ specifier: ^29.4.1
+ version: 29.4.1(@babel/core@7.28.4)(esbuild@0.25.3)(jest@29.7.0)(typescript@5.8.3)
+ ts-loader:
+ specifier: ^9.5.4
+ version: 9.5.4(typescript@5.8.3)(webpack@5.99.7)
+ tsup:
+ specifier: ^8.5.0
+ version: 8.5.0(typescript@5.8.3)
+ typedoc:
+ specifier: ^0.28.12
+ version: 0.28.12(typescript@5.8.3)
+ typedoc-plugin-missing-exports:
+ specifier: ^4.1.0
+ version: 4.1.0(typedoc@0.28.12)
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
+ packages/bcs:
+ dependencies:
+ '@aptos-labs/utils':
+ specifier: workspace:*
+ version: link:../utils
+ '@noble/hashes':
+ specifier: ^1.5.0
+ version: 1.8.0
+ devDependencies:
+ tsup:
+ specifier: ^8.5.0
+ version: 8.5.0(typescript@5.8.3)
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
+ packages/core:
+ dependencies:
+ '@aptos-labs/bcs':
+ specifier: workspace:*
+ version: link:../bcs
+ '@aptos-labs/utils':
+ specifier: workspace:*
+ version: link:../utils
+ devDependencies:
+ tsup:
+ specifier: ^8.5.0
+ version: 8.5.0(typescript@5.8.3)
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
+ packages/utils:
+ dependencies:
+ '@noble/hashes':
+ specifier: ^1.5.0
+ version: 1.8.0
+ devDependencies:
+ tsup:
+ specifier: ^8.5.0
+ version: 8.5.0(typescript@5.8.3)
packages:
@@ -8138,7 +8182,7 @@ packages:
engines: {node: '>=16 || 14 >=14.17'}
hasBin: true
dependencies:
- '@jridgewell/gen-mapping': 0.3.8
+ '@jridgewell/gen-mapping': 0.3.13
commander: 4.1.1
glob: 10.4.5
lines-and-columns: 1.2.4
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
new file mode 100644
index 000000000..78d6f5a14
--- /dev/null
+++ b/pnpm-workspace.yaml
@@ -0,0 +1,11 @@
+packages:
+ - packages/*
+catalog:
+ "@noble/curves": "^1.9.0"
+ "@noble/hashes": "^1.5.0"
+ "@scure/bip32": "^1.4.0"
+ "@scure/bip39": "^1.3.0"
+ "eventemitter3": "^5.0.1"
+ "js-base64": "^3.7.7"
+ "jwt-decode": "^4.0.0"
+ "poseidon-lite": "^0.2.0"
\ No newline at end of file