Abstract
Validates that the Keyless Account can be used to sign transactions.
+This initializes the asynchronous proof fetch.
+Emits whether the proof succeeds or fails, but has no return.
+Serializes the jwt data into a format suitable for transmission or storage. +This function ensures that both the jwt data and the proof are properly serialized.
+The serializer instance used to convert the jwt data into bytes.
+Sign the given message using Keyless.
+in HexInput format
+Signature
+Sign the given transaction with Keyless. +Signs the transaction and proof to guard against proof malleability.
+the transaction to be signed
+KeylessSignature
+Sign a transaction using Keyless.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using Keyless.
+the message to sign, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
+Verifies a signature given the message.
+TODO: Groth16 proof verification
+the message that was signed.
+the KeylessSignature to verify
+boolean
+Static
fetchJWKFetches the JWK from the issuer's well-known JWKS endpoint.
+The kid of the JWK to fetch
+The keyless public key to query
+A JWK matching the kid
in the JWT header.
Static
partialOptional
verificationReadonly
accountAccount address associated with the account
+Readonly
audThe value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's +OIDC registration with the identity provider.
+Readonly
ephemeralThe EphemeralKeyPair used to generate sign.
+Readonly
jwtThe JWT token used to derive the account
+Readonly
pepperA value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
+The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
+Readonly
proofThe proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on +fetching the proof.
+Readonly
publicThe KeylessPublicKey associated with the account
+Readonly
signingSigning scheme used to sign transactions
+Readonly
uidThe claim on the JWT to identify a user. This is typically 'sub' or 'email'.
+Readonly
uidThe value of the uidKey claim on the JWT. This intended to be a stable user identifier.
+Optional
Readonly
verificationThe hash of the verification key used to verify the proof. This is optional and can be used to check verifying key +rotations which may invalidate the proof.
+Static
Readonly
PEPPER_Abstract
Abstract class representing a generic Aptos account.
+This class serves as a single entry point for account generation, allowing accounts to be created
+either through Account.generate()
or Account.fromDerivationPath
. Although it is defined as an
+abstract class, it should be treated as an interface and enforced using the implements
keyword.
Note: Generating an account instance does not create the account on-chain.
+Abstract
signAbstract
signSign the given transaction using the available signing capabilities.
+the transaction to be signed
+Signature
+Abstract
signSign a transaction using the available signing capabilities.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Abstract
signSign a message using the available signing capabilities.
+the signing message, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Verify the given message and signature with the public key. +This function helps ensure the integrity and authenticity of a message by validating its signature.
+The arguments for verifying the signature.
+A boolean indicating whether the signature is valid.
+Static
authRetrieve the authentication key for the associated account using the provided public key. +This key enables account owners to rotate their private key(s) associated with the account without changing the address that +hosts their account. +See here for more info: https://aptos.dev/concepts/accounts#single-signer-authentication
+The arguments for retrieving the authentication key.
+The public key of the account.
+The authentication key for the associated account.
+Static
fromGenerates an account from a specified derivation path and mnemonic. +This function allows you to create an account using different signing schemes based on the provided arguments.
+The arguments for generating the account.
+Static
fromCreates an account from a given private key and address. +This function allows you to instantiate an account based on the provided private key, +and it can differentiate between legacy and non-legacy accounts.
+The arguments for creating the account.
+An instance of either Ed25519Account or SingleKeyAccount based on the provided private key.
+Static
fromThe arguments required to create an account from a private key.
+Account
+Static
generateGenerates a new account based on the specified signing scheme and legacy option. +This function allows you to create an account with either the Ed25519 signing scheme or a different scheme as specified.
+Optional
args: GenerateEd25519AccountArgsThe arguments for generating the account.
+NOTE: Only use this class for account addresses. For other hex data, e.g. transaction +hashes, use the Hex class.
+AccountAddress is used for working with account addresses. Account addresses, when +represented as a string, generally look like these examples:
+Proper formatting and parsing of account addresses is defined by AIP-40. +To learn more about the standard, read the AIP here: +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
+The comments in this class make frequent reference to the LONG and SHORT formats, +as well as "special" addresses. To learn what these refer to see AIP-40.
+Creates an instance of AccountAddress from a Uint8Array.
+This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.
+A Uint8Array representing an account address.
+Determine if two AccountAddresses are equal based on their underlying byte data.
+The AccountAddress to compare to.
+true if the AccountAddresses are equal, false if not.
+Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive. +In other words, the last byte of the address must be < 0b10000 (16) +and every other byte must be zero.
+For more information on how special addresses are defined, see AIP-40: +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
+true if the address is special, false otherwise.
+Serialize the AccountAddress to a Serializer instance's data buffer.
+The serializer to serialize the AccountAddress to.
+void
+Serializes the current instance into a byte sequence suitable for entry functions. +This allows for the proper encoding of data when interacting with entry functions in the blockchain.
+The serializer instance used to convert the data into bytes.
+Serializes the current instance for use in a script function by encoding it into a byte sequence. +This process involves serializing the variant index and the instance data, making it suitable for transmission.
+The serializer instance used to perform the serialization.
+Return the AccountAddress as a string as per AIP-40. +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md. +This representation returns special addresses in SHORT form (0xf) +and other addresses in LONG form (0x + 64 characters).
+AccountAddress as a string conforming to AIP-40.
+Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.
+NOTE: Prefer to use toString
where possible, as it formats special addresses using the SHORT form (no leading 0s).
AccountAddress as a string in LONG form.
+Returns the account address as a string in LONG form without a leading 0x. +This function will include leading zeroes and will produce a string of 64 hex characters.
+NOTE: Prefer to use toString
where possible, as it formats special addresses using the SHORT form (no leading 0s).
The account address in LONG form.
+Static
deserializeDeserialize an AccountAddress from the byte buffer in a Deserializer instance. +This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.
+The deserializer to deserialize the AccountAddress from.
+An instance of AccountAddress.
+Static
fromConvenience method for creating an AccountAddress from various input types. +This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding +AccountAddress.
+The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array, +or an existing AccountAddress.
+Optional
maxStatic
fromCreate an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.
+The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.
+Static
fromNOTE: This function has relaxed parsing behavior. For strict behavior, please use
+the fromStringStrict
function. Where possible use fromStringStrict
rather than this
+function, fromString
.
Creates an instance of AccountAddress from a hex string.
+This function allows all formats defined by AIP-40. In short this means the +following formats are accepted:
+Where:
+maxMissingChars
before it is padded.Learn more about the different address formats by reading AIP-40: +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
+A hex string representing an account address.
+Optional
maxAn instance of AccountAddress.
+Static
fromNOTE: This function has strict parsing behavior. For relaxed behavior, please use
+the fromString
function.
Creates an instance of AccountAddress from a hex string.
+This function allows only the strictest formats defined by AIP-40. In short this +means only the following formats are accepted:
+Where:
+This means the following are not accepted:
+A hex string representing an account address.
+An instance of AccountAddress.
+This function has strict parsing behavior. For relaxed behavior, please use the fromString
function.
AIP-40 documentation for more details on address formats: +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
+Static
isCheck if the provided input is a valid AccountAddress.
+The arguments for validation.
+A hex string representing an account address.
+Optional
strict?: booleanIf true, use strict parsing behavior; if false, use relaxed parsing behavior.
+An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details. +If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.
+Readonly
dataThis is the internal representation of an account address.
+Static
AStatic
FOURStatic
Readonly
LENGTHThe number of bytes that make up an account address.
+Static
Readonly
LONG_The length of an address string in LONG form without a leading 0x.
+Static
ONEStatic
THREEStatic
TWOStatic
ZEROAbstract
Represents an account authenticator that can handle multiple authentication variants. +This class serves as a base for different types of account authenticators, allowing for serialization +and deserialization of various authenticator types.
+Determines if the current instance is an Ed25519 account authenticator.
+True if the instance is of type AccountAuthenticatorEd25519, otherwise false.
+Determines if the current instance is of type AccountAuthenticatorMultiEd25519.
+True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.
+Determine if the current instance is of type AccountAuthenticatorMultiKey.
+Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.
+Determines if the current instance is of the type AccountAuthenticatorSingleKey.
+True if the instance is an AccountAuthenticatorSingleKey, otherwise false.
+Abstract
serializeStatic
deserializeDeserializes an AccountAuthenticator from the provided deserializer. +This function helps in reconstructing the AccountAuthenticator object based on the variant index.
+The deserializer instance used to read the serialized data.
+Represents an Ed25519 transaction authenticator for multi-signer transactions. +This class encapsulates the account's Ed25519 public key and signature.
+Creates an instance of the class with the specified public keys and signatures.
+The public key used for verification.
+The signatures corresponding to the public keys.
+Determines if the current instance is an Ed25519 account authenticator.
+True if the instance is of type AccountAuthenticatorEd25519, otherwise false.
+Determines if the current instance is of type AccountAuthenticatorMultiEd25519.
+True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.
+Determine if the current instance is of type AccountAuthenticatorMultiKey.
+Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.
+Determines if the current instance is of the type AccountAuthenticatorSingleKey.
+True if the instance is an AccountAuthenticatorSingleKey, otherwise false.
+Serializes the account authenticator data into the provided serializer. +This function captures the multi-key variant, public keys, and signatures for serialization.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes an AccountAuthenticator from the provided deserializer. +This function helps in reconstructing the AccountAuthenticator object based on the variant index.
+The deserializer instance used to read the serialized data.
+Static
loadLoads an instance of AccountAuthenticatorMultiKey from the provided deserializer. +This function helps in reconstructing the authenticator object using the deserialized public keys and signatures.
+The deserializer used to extract the necessary data for loading the authenticator.
+Represents a transaction authenticator for Multi Ed25519, designed for multi-signer transactions.
+Determines if the current instance is an Ed25519 account authenticator.
+True if the instance is of type AccountAuthenticatorEd25519, otherwise false.
+Determines if the current instance is of type AccountAuthenticatorMultiEd25519.
+True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.
+Determine if the current instance is of type AccountAuthenticatorMultiKey.
+Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.
+Determines if the current instance is of the type AccountAuthenticatorSingleKey.
+True if the instance is an AccountAuthenticatorSingleKey, otherwise false.
+Static
deserializeDeserializes an AccountAuthenticator from the provided deserializer. +This function helps in reconstructing the AccountAuthenticator object based on the variant index.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents an account authenticator that supports multiple keys and signatures for multi-signature scenarios.
+Determines if the current instance is an Ed25519 account authenticator.
+True if the instance is of type AccountAuthenticatorEd25519, otherwise false.
+Determines if the current instance is of type AccountAuthenticatorMultiEd25519.
+True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.
+Determine if the current instance is of type AccountAuthenticatorMultiKey.
+Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.
+Determines if the current instance is of the type AccountAuthenticatorSingleKey.
+True if the instance is an AccountAuthenticatorSingleKey, otherwise false.
+Static
deserializeDeserializes an AccountAuthenticator from the provided deserializer. +This function helps in reconstructing the AccountAuthenticator object based on the variant index.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents an account authenticator that utilizes a single key for signing. +This class is designed to handle authentication using a public key and its corresponding signature.
+Determines if the current instance is an Ed25519 account authenticator.
+True if the instance is of type AccountAuthenticatorEd25519, otherwise false.
+Determines if the current instance is of type AccountAuthenticatorMultiEd25519.
+True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.
+Determine if the current instance is of type AccountAuthenticatorMultiKey.
+Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.
+Determines if the current instance is of the type AccountAuthenticatorSingleKey.
+True if the instance is an AccountAuthenticatorSingleKey, otherwise false.
+Static
deserializeDeserializes an AccountAuthenticator from the provided deserializer. +This function helps in reconstructing the AccountAuthenticator object based on the variant index.
+The deserializer instance used to read the serialized data.
+Static
loadAbstract
An abstract representation of an account public key.
+Provides a common interface for deriving an authentication key.
+Abstract
authGet the authentication key associated with this public key
+Abstract
serializeAbstract
verifyVerifies that the private key associated with this public key signed the message with the given signature.
+Represents an account's sequence number management for transaction handling on the Aptos blockchain. +This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number, +and manage local sequence numbers while ensuring thread safety.
+Creates an instance of the class with the specified configuration and account details. +This constructor initializes the necessary parameters for managing Aptos transactions.
+The configuration settings for Aptos.
+The account associated with the Aptos transactions.
+The maximum time to wait for a transaction to be processed, in milliseconds.
+The maximum number of transactions that can be in flight at the same time.
+The time to sleep between transaction checks, in milliseconds.
+Returns the next available sequence number for this account. +This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits.
+The next available sequence number.
+Readonly
accountReadonly
aptosWe want to guarantee that we preserve ordering of workers to requests.
+lock
is used to try to prevent multiple coroutines from accessing a shared resource at the same time,
+which can result in race conditions and data inconsistency.
+This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.
The ideal solution is likely that each thread grabs the next number from an incremental integer.
+When they complete, they increment that number and that entity is able to enter the lock
.
+That would guarantee ordering.
Represents any public key supported by Aptos.
+Since AIP-55 Aptos supports
+Legacy
and Unified
authentication keys.
Any unified authentication key is represented in the SDK as AnyPublicKey
.
Creates an instance of the signature class based on the provided signature type. +This allows for the handling of different signature variants such as Ed25519, Secp256k1, and Keyless.
+The publicKey object which determines the variant to be used.
+Generates an authentication key from the current instance's byte representation. +This function is essential for creating a unique identifier for authentication purposes.
+The generated authentication key.
+Serializes the current object using the provided serializer. +This function helps in converting the object into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Verifies the provided signature against the given message. +This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.
+The arguments for signature verification.
+A boolean indicating whether the signature is valid for the given message.
+Static
deserializeDeserializes an AnySignature from the provided deserializer. +This function helps in reconstructing the AnySignature object from its serialized form, allowing for further processing or validation.
+The deserializer instance used to read the serialized data.
+Static
isDetermines if the provided publicKey is an instance of a valid PublicKey object.
+The publicKey to be checked for validity.
+True if the signature is a valid instance; otherwise, false.
+Static
isDetermines if the provided public key is an instance of AnyPublicKey.
+The public key to check.
+Represents a signature that utilizes the SingleKey authentication scheme.
+This class is designed to encapsulate various types of signatures, which can
+only be generated by a SingleKeySigner
due to the shared authentication mechanism.
Static
deserializeStatic
isThe main entry point for interacting with the Aptos APIs, +providing access to various functionalities organized into +distinct namespaces.
+To utilize the SDK, instantiate a new Aptos object to gain +access to the complete range of SDK features.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for connecting to the Aptos testnet
const config = new AptosConfig({ network: Network.TESTNET });
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Initializes a new instance of the Aptos client with the provided configuration settings. +This allows you to interact with various Aptos functionalities such as accounts, transactions, and events.
+Optional
settings: AptosConfigConfiguration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client with default settings
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own settings if needed
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Add a digital asset property to the blockchain. +This function allows you to specify a new property for a digital asset, including its key, type, and value.
+The arguments for adding a digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digital(Optional) The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptions(Optional) Options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Add a digital asset property
const transaction = await aptos.addDigitalAssetPropertyTransaction({
creator: Account.generate(), // Replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Add a typed digital asset property to the blockchain. +This function allows you to define and store a specific property for a digital asset, enabling better categorization and +management of digital assets.
+The parameters for adding the typed property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digitalThe optional type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction generation options.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Adding a typed digital asset property
const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "typedKey",
propertyType: "STRING",
propertyValue: "hello",
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+The arguments for batching transactions.
+An array of transaction payloads to be processed.
+Optional
options?: Omit<InputGenerateTransactionOptions, "accountSequenceNumber">Optional. Transaction generation configurations (excluding accountSequenceNumber).
+The sender account to sign and submit the transactions.
+Prefer to use aptos.transaction.batch.forSingleAccount()
Batch transactions for a single account by submitting multiple transaction payloads. +This function is useful for efficiently processing and submitting transactions that do not depend on each other, such as +batch funding or batch token minting.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
const sender = Account.generate(); // Generate a new account for sending transactions
async function runExample() {
const transactions = [
{ }, // Build your first transaction payload
{ }, // Build your second transaction payload
];
// Batch transactions for the single account
await aptos.batchTransactionsForSingleAccount({
sender,
data: transactions,
});
console.log("Batch transactions submitted successfully.");
}
runExample().catch(console.error);
+
+
+Burn a digital asset by its creator, allowing for the removal of a specified digital asset from the blockchain.
+The arguments for burning the digital asset.
+The creator account that is burning the digital asset.
+The address of the digital asset to be burned.
+Optional
digitalOptional. The type of the digital asset being burned.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const creator = Account.generate(); // Replace with a real creator account
const transaction = await aptos.burnDigitalAssetTransaction({
creator: creator,
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Creates a new collection within the specified account.
+A SimpleTransaction that when submitted will create the collection.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Creating a new collection transaction
const transaction = await aptos.createCollectionTransaction({
creator: Account.generate(), // Replace with a real account
description: "A unique collection of digital assets.",
name: "My Digital Collection",
uri: "https://mycollection.com",
});
console.log("Transaction created:", transaction);
}
runExample().catch(console.error);
+
+
+Derives an account by providing a private key. This function resolves the provided private key type and derives the public +key from it.
+If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey +scheme locally. +If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519 +key or a Unified ED25519 key, and then derives the account based on that.
+The arguments for deriving the account.
+An account private key.
+The derived Account type.
+import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Deriving an account from a private key
const account = await aptos.deriveAccountFromPrivateKey({
privateKey: new Ed25519PrivateKey("0x123") // replace with a real private key
});
console.log(account);
}
runExample().catch(console.error);
+
+
+Optional
pepper?: HexInputOptional
proofOptional
uidOptional
pepper?: HexInputOptional
proofOptional
uidFreeze the ability to transfer a specified digital asset. +This function allows the creator to restrict the transfer capability of a digital asset.
+The arguments for freezing the digital asset transfer.
+The creator account initiating the freeze.
+The address of the digital asset to be frozen.
+Optional
digitalOptional. The type of the digital asset being frozen.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Freeze the digital asset transfer
const transaction = await aptos.freezeDigitalAssetTransaferTransaction({
creator: Account.generate(), // Replace with a real account if needed
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+This function creates an account if it does not exist and mints the specified amount of coins into that account.
+The arguments for funding the account.
+The address of the account to fund.
+The amount of tokens to fund the account with.
+Optional
options?: WaitForTransactionOptionsConfiguration options for waiting for the transaction.
+Transaction hash of the transaction that funded the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fund an account with a specified amount of tokens
const transaction = await aptos.fundAccount({
accountAddress: "0x1", // replace with your account address
amount: 100,
});
console.log("Transaction hash:", transaction.hash);
}
runExample().catch(console.error);
+
+
+Retrieves the current amount of APT for a specified account.
+The arguments for the account query.
+The account address for which to retrieve the APT amount.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current amount of APT for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the APT amount for a specific account
const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: "0x1" }); // replace with a real account address
console.log("Account APT Amount:", accountAPTAmount);
}
runExample().catch(console.error);
+
+
+Queries the current amount of a specified coin held by an account.
+The parameters for querying the account's coin amount.
+The account address to query for the coin amount.
+Optional
coinThe coin type to query. Note: If not provided, it may be automatically populated if faMetadataAddress
+is specified.
Optional
faThe fungible asset metadata address to query. Note: If not provided, it may be automatically
+populated if coinType
is specified.
Optional
minimumNot used anymore, here for backward compatibility +see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, will be removed in the near future. +Optional ledger version to sync up to before querying.
+The current amount of the specified coin held by the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Query the account's coin amount for a specific coin type
const accountCoinAmount = await aptos.getAccountCoinAmount({
accountAddress: "0x1", // replace with a real account address
coinType: "0x1::aptos_coin::AptosCoin" // specify the coin type
});
console.log(`Account coin amount: ${accountCoinAmount}`);
}
runExample().catch(console.error);
+
+
+Retrieves the current count of an account's coins aggregated across all types.
+The parameters for the account coins count query.
+The account address we want to get the total count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current count of the aggregated coins for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Getting the account coins count for a specific account
const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: "0x1" }); // replace with a real account address
console.log("Account Coins Count:", accountCoinsCount);
}
runExample().catch(console.error);
+
+
+Retrieves the coins data for a specified account.
+The account address for which to retrieve the coin's data.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ An array containing the coins data for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching coins data for a specific account
const accountCoinsData = await aptos.getAccountCoinsData({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of results to return
orderBy: { asset_type: "asc" }, // specify the order of results
},
});
console.log(accountCoinsData);
}
runExample().catch(console.error);
+
+
+Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens. +If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.
+The account address we want to get the collections for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ Collections array with the collections data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get account collections with owned tokens for a specific account
const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({
accountAddress: "0x1", // replace with a real account address
options: {
tokenStandard: "NFT", // specify the token standard if needed
limit: 10, // specify the number of results to return
},
});
console.log(accountCollectionsWithOwnedTokens);
}
runExample().catch(console.error);
+
+
+Fetches all top-level domain names for a specified account.
+The arguments for retrieving account domains.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching all top-level domain names for a specific account
const domains = await aptos.getAccountDomains({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of names to fetch
offset: 0, // specify the offset for pagination
orderBy: "created_at", // specify the order by which to sort the names
where: {
// additional filters can be specified here
},
},
});
console.log(domains);
}
runExample().catch(console.error);
+
+
+Retrieve events associated with a specific account address and creation number.
+The parameters for retrieving account events.
+The account address to query events for.
+The event creation number to filter the events.
+Optional
minimumOptional minimum ledger version to sync up to before querying.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get events for the account at creation number 0
const events = await aptos.getAccountEventsByCreationNumber({
accountAddress: "0x1", // replace with a real account address
creationNumber: 0,
});
console.log(events);
}
runExample().catch(console.error);
+
+
+Retrieve events associated with a specific account address and event type.
+The account address to query events for.
+The type of event to filter by.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the event query.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get events for a specific account and event type
const events = await aptos.getAccountEventsByEventType({
accountAddress: "0x1", // replace with a real account address
eventType: "0x1::transaction_fee::FeeStatement", // replace with a real event type
minimumLedgerVersion: 1, // optional, specify if needed
});
console.log(events);
}
runExample().catch(console.error);
+
+
+Queries the current state for an Aptos account given its account address.
+The arguments for retrieving account information.
+The Aptos account address to query.
+The account data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve account information for a specific address
const accountInfo = await aptos.getAccountInfo({ accountAddress: "0x1" }); // replace with a real account address
console.log(accountInfo);
}
runExample().catch(console.error);
+
+
+Queries for a specific account module given an account address and module name.
+The Aptos account address.
+The name of the module.
+Optional
options?: LedgerVersionArgThe account module associated with the specified account address and module name.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the account module for a specific account address and module name
const module = await aptos.getAccountModule({
accountAddress: "0x1", // replace with a real account address
moduleName: "MyModule" // specify the module name
});
console.log(module);
}
runExample().catch(console.error);
+
+
+Queries for all modules in an account given an account address. +This function may call the API multiple times to auto paginate through results.
+The Aptos account address to query modules for.
+Optional
options?: PaginationArgs & LedgerVersionArgimport { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching account modules for a specific account
const accountModules = await aptos.getAccountModules({
accountAddress: "0x1", // replace with a real account address
options: {
offset: 0, // starting from the first module
limit: 10, // limiting to 10 modules
},
});
console.log(accountModules);
}
runExample().catch(console.error);
+
+
+Fetches all names for an account, including both top-level domains and subdomains.
+The arguments for fetching account names.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch account names for a specific address
const accountNames = await aptos.getAccountNames({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify how many names to fetch
orderBy: "name", // specify the order by which to sort the names
},
});
console.log(accountNames);
}
runExample().catch(console.error);
+
+
+Queries an account's owned objects.
+The account address we want to get the objects for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Objects array with the object data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the objects owned by the specified account
const accountOwnedObjects = await aptos.getAccountOwnedObjects({
accountAddress: "0x1", // replace with a real account address
minimumLedgerVersion: 1, // optional, specify if needed
options: {
offset: 0, // optional, specify if needed
limit: 10, // optional, specify if needed
orderBy: "created_at", // optional, specify if needed
},
});
console.log(accountOwnedObjects);
}
runExample().catch(console.error);
+
+
+Queries the tokens currently owned by a specified account, including NFTs and fungible tokens. +If desired, you can filter the results by a specific token standard.
+The account address for which to retrieve owned tokens.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ An array of tokens with their respective data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the tokens owned by a specific account
const accountOwnedTokens = await aptos.getAccountOwnedTokens({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify how many tokens to return
orderBy: "created_at", // specify the order of the results
},
});
console.log(accountOwnedTokens);
}
runExample().catch(console.error);
+
+
+Queries all current tokens of a specific collection that an account owns by the collection address. +This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc. +If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.
+The account address we want to get the tokens for.
+The address of the collection being queried.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ Tokens array with the token data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get tokens owned by a specific account in a specific collection
const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({
accountAddress: "0x1", // replace with a real account address
collectionAddress: "0x2", // replace with a real collection address
});
console.log(accountOwnedTokens);
}
runExample().catch(console.error);
+
+
+Queries a specific account resource given an account address and resource type.
+The Aptos account address to query.
+Optional
options?: LedgerVersionArgThe string representation of an on-chain Move struct type, e.g., "0x1::aptos_coin::AptosCoin".
+The account resource of the specified type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the account resource for a specific account address and resource type
const resource = await aptos.getAccountResource({
accountAddress: "0x1", // replace with a real account address
resourceType: "0x1::aptos_coin::AptosCoin"
});
console.log(resource);
}
runExample().catch(console.error);
+
+
+Queries all account resources given an account address. +This function may call the API multiple times to auto paginate through results.
+The Aptos account address to query resources for.
+Optional
options?: PaginationArgs & LedgerVersionArgAccount resources.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching account resources for a specific account address
const resources = await aptos.getAccountResources({ accountAddress: "0x1" }); // replace with a real account address
console.log(resources);
}
runExample().catch(console.error);
+
+
+Fetches all subdomain names for a specified account.
+The arguments for retrieving subdomains.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching subdomain names for a specific account
const subdomains = await aptos.getAccountSubdomains({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of subdomains to fetch
offset: 0, // specify the offset for pagination
orderBy: "name", // specify the order by which to sort the names
},
});
console.log(subdomains);
}
runExample().catch(console.error);
+
+
+Queries the current count of tokens owned by a specified account.
+The parameters for the query.
+The account address to query the token count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current count of tokens owned by the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the count of tokens owned by the account
const tokensCount = await aptos.getAccountTokensCount({ accountAddress: "0x1" }); // replace with a real account address
console.log(`Tokens Count: ${tokensCount}`);
}
runExample().catch(console.error);
+
+
+Queries account transactions given an account address. +This function may call the API multiple times to auto paginate and retrieve all account transactions.
+The Aptos account address to query transactions for.
+Optional
options?: PaginationArgsOptional pagination arguments.
+The account transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch transactions for a specific account
const transactions = await aptos.getAccountTransactions({
accountAddress: "0x1", // replace with a real account address
options: {
offset: 0, // starting from the first transaction
limit: 10, // limiting to 10 transactions
},
});
console.log(transactions);
}
runExample().catch(console.error);
+
+
+Queries the current count of transactions submitted by an account.
+The parameters for the query.
+The account address we want to get the total count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Current count of transactions made by an account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the count of transactions for a specific account
const accountTransactionsCount = await aptos.getAccountTransactionsCount({
accountAddress: "0x1", // replace with a real account address
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
});
console.log(accountTransactionsCount);
}
runExample().catch(console.error);
+
+
+Retrieve a block by its height, allowing for the inclusion of transactions if specified.
+The parameters for the block retrieval.
+The block height to look up, starting at 0.
+Optional
options?: { Optional settings for the retrieval.
+Optional
withThe block with optional transactions included.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the block at height 5, including transactions
const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } });
console.log(block);
}
runExample().catch(console.error);
+
+
+Retrieves block information by the specified ledger version.
+The arguments for retrieving the block.
+The ledger version to lookup block information for.
+Optional
options?: { Optional parameters for the request.
+Optional
withBlock information with optional transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve block information for a specific ledger version
const block = await aptos.getBlockByVersion({ ledgerVersion: 5 });
console.log(block);
}
runExample().catch(console.error);
+
+
+Retrieves the chain ID of the Aptos blockchain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the chain ID
const chainId = await aptos.getChainId();
console.log("Chain ID:", chainId);
}
runExample().catch(console.error);
@returns The chain ID of the Aptos blockchain.
+
+
+Queries the top user transactions based on the specified limit.
+The arguments for querying top user transactions.
+The number of transactions to return.
+GetChainTopUserTransactionsResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch the top user transactions with a limit of 5
const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 });
console.log(topUserTransactions);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection creator address and the collection name.
+This function is deprecated; use getCollectionDataByCreatorAddressAndCollectionName
instead.
If a creator account has two collections with the same name in v1 and v2, you can pass an optional tokenStandard
parameter
+to query a specific standard.
The arguments for querying the collection data.
+The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArgOptional parameters for the query.
+GetCollectionDataResponse - The response type containing the collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Querying collection data by creator address and collection name
const collection = await aptos.getCollectionData({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection", // specify your collection name
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection ID.
+The ID of the collection, which is the same as the address of the collection object.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsOptional parameters for token standard and pagination.
+GetCollectionDataResponse - The response type containing the collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching collection data by collection ID
const collection = await aptos.getCollectionDataByCollectionId({
collectionId: "0x123", // replace with a real collection ID
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Retrieves data for a specific collection created by a given creator address. +This function allows you to query collection data while optionally specifying a minimum ledger version and pagination options.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse - The response type containing collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve collection data by creator address
const collectionData = await aptos.getCollectionDataByCreatorAddress({
creatorAddress: "0x1", // replace with a real creator address
minimumLedgerVersion: 1, // specify the minimum ledger version if needed
options: {
tokenStandard: "v2", // specify the token standard if needed
pagination: { limit: 10, offset: 0 } // specify pagination options if needed
}
});
console.log(collectionData);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection creator address and the collection name.
+If a creator account has multiple collections with the same name across different versions,
+specify the tokenStandard
parameter to query a specific standard.
The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse - The response type containing collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching collection data by creator address and collection name
const collection = await aptos.getCollectionDataByCreatorAddressAndCollectionName({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection",
minimumLedgerVersion: 1, // optional, specify if needed
options: { tokenStandard: "v2" } // optional, specify if needed
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Queries the ID of a specified collection. +This ID corresponds to the collection's object address in V2, while V1 does not utilize objects and lacks an address.
+The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArgThe collection ID.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the collection ID for a specific creator and collection name
const collectionId = await aptos.getCollectionId({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection"
});
console.log("Collection ID:", collectionId);
}
runExample().catch(console.error);
+
+
+Retrieves the current ownership data of a specified digital asset using its address.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Getting the current ownership of a digital asset
const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAssetOwner);
}
runExample().catch(console.error);
+
+
+Queries all fungible asset balances.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching current fungible asset balances
const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances();
console.log(fungibleAssetBalances);
}
runExample().catch(console.error);
+
+
+Queries delegated staking activities for a specific delegator and pool.
+The arguments for querying delegated staking activities.
+The address of the delegator.
+Optional
minimumOptional ledger version to sync up to before querying.
+The address of the staking pool.
+The response containing delegated staking activities.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get delegated staking activities for a specific delegator and pool
const activities = await aptos.getDelegatedStakingActivities({
delegatorAddress: "0x1", // replace with a real delegator address
poolAddress: "0x2", // replace with a real pool address
minimumLedgerVersion: 1, // specify your own if needed
});
console.log(activities);
}
runExample().catch(console.error);
+
+
+Retrieves the activity data for a specified digital asset using its address.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional minimum ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters.
+A promise that resolves to the activity data related to the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the activity data for a digital asset
const digitalAssetActivity = await aptos.getDigitalAssetActivity({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAssetActivity);
}
runExample().catch(console.error);
+
+
+Retrieves digital asset data using the address of a digital asset.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+GetTokenDataResponse containing relevant data for the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching digital asset data for a specific address
const digitalAsset = await aptos.getDigitalAssetData({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAsset);
}
runExample().catch(console.error);
+
+
+Fetches all subdomain names for a given domain, excluding the domain itself.
+The arguments for fetching subdomains.
+A promise that resolves to an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching subdomains for a specific domain
const subdomains = await aptos.getDomainSubdomains({
domain: "test", // replace with your domain
options: {
limit: 10, // specify the number of subdomains to fetch
offset: 0, // specify the starting point for fetching
orderBy: "name", // specify the order by which to sort the results
},
});
console.log(subdomains);
}
runExample().catch(console.error);
+
+
+Retrieve all events from the Aptos blockchain.
+An optional where
clause can be provided to filter the results based on specific criteria.
Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and filtering options.
+GetEventsQuery response type containing the events.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve all events
const events = await aptos.getEvents();
// Retrieve events with filtering by account address
const whereCondition = {
account_address: { _eq: "0x123" }, // replace with a real account address
};
const filteredEvents = await aptos.getEvents({
options: { where: whereCondition },
});
console.log(events);
console.log(filteredEvents);
}
runExample().catch(console.error);
+
+
+Retrieve the expiration time of a domain name or subdomain name from the contract.
+The arguments for retrieving the expiration.
+A string of the name to retrieve.
+number as a unix timestamp in milliseconds.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the expiration time for the domain "test.aptos"
const exp = await aptos.getExpiration({ name: "test.aptos" });
// Log the expiration date
console.log(new Date(exp)); // Outputs the expiration date
}
runExample().catch(console.error);
+
+
+Queries all fungible asset activities and returns a list of their metadata.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching fungible asset activities
const fungibleAssetActivities = await aptos.getFungibleAssetActivities();
console.log(fungibleAssetActivities);
}
runExample().catch(console.error);
+
+
+Queries all fungible asset metadata.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching fungible asset metadata
const fungibleAssets = await aptos.getFungibleAssetMetadata();
console.log(fungibleAssets);
}
runExample().catch(console.error);
+
+
+Queries the fungible asset metadata for a specific asset type. +This function helps retrieve detailed information about a fungible asset based on its type.
+A fungible asset metadata item.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve fungible asset metadata by asset type
const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({
assetType: "0x1::aptos_coin::AptosCoin" // replace with your asset type
});
console.log(fungibleAsset);
}
runExample().catch(console.error);
+
+
+Retrieves fungible asset metadata based on the creator address.
+This function allows you to query metadata for a specific fungible asset created by a given address.
+The parameters for the query.
+The creator address of the fungible asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+A fungible asset metadata item.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve fungible asset metadata by creator address
const fungibleAsset = await aptos.getFungibleAssetMetadataByCreatorAddress({
creatorAddress: "0x123", // replace with a real creator address
});
console.log(fungibleAsset);
}
runExample().catch(console.error);
+
+
+Estimates the gas unit price required to process a transaction on the Aptos blockchain in a timely manner. +This helps users to understand the cost associated with their transactions. +https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price
+An object containing the estimated gas price.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network
const aptos = new Aptos(config);
async function runExample() {
// Getting the gas price estimation
const gasPriceEstimation = await aptos.getGasPriceEstimation();
console.log("Estimated Gas Price:", gasPriceEstimation);
}
runExample().catch(console.error);
+
+
+Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which +may lag behind the full nodes.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the last successful indexer version
const version = await aptos.getIndexerLastSuccessVersion();
console.log(`Last successful indexer version: ${version}`);
}
runExample().catch(console.error);
+
+
+Queries for the Aptos ledger information.
+The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the ledger information
const ledgerInfo = await aptos.getLedgerInfo();
console.log(ledgerInfo);
}
runExample().catch(console.error);
+
+
+Retrieve module events based on a specified event type. +This function allows you to query for events that are associated with a particular module event type in the Aptos blockchain.
+The arguments for retrieving module events.
+The event type to filter the results.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the event results.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve module events for a specific event type
const events = await aptos.getModuleEventsByEventType({
eventType: "0x1::transaction_fee::FeeStatement", // specify the event type
minimumLedgerVersion: 1, // optional: specify minimum ledger version if needed
});
console.log(events); // log the retrieved events
}
runExample().catch(console.error);
+
+
+Fetches a single name from the indexer based on the provided name argument.
+The arguments for retrieving the name.
+A string of the name to retrieve, e.g. "test.aptos.apt" or "test.apt" or "test". +Can be inclusive or exclusive of the .apt suffix and can be a subdomain.
+A promise of an ANSName or undefined if the name is not active.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching a name from the indexer
const name = await aptos.getName({ name: "test.aptos" }); // replace with a real name
console.log(name);
}
runExample().catch(console.error);
+
+
+Queries the current number of delegators in a specified pool. Throws an error if the pool is not found.
+The parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+The address of the pool to query.
+The number of delegators for the given pool.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the number of delegators for a specific pool
const delegators = await aptos.getNumberOfDelegators({ poolAddress: "0x1" }); // replace with a real pool address
console.log(`Number of delegators: ${delegators}`);
}
runExample().catch(console.error);
+
+
+Retrieves the current number of delegators across all pools.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: OrderByArg<{ Optional ordering options for the response.
+GetNumberOfDelegatorsForAllPoolsResponse response type containing the number of delegators per pool.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the number of delegators for all pools
const delegators = await aptos.getNumberOfDelegatorsForAllPools();
console.log(delegators);
}
runExample().catch(console.error);
+
+
+Fetches the object data based on the specified object address.
+Optional
minimumOptional minimum ledger version to wait for.
+The object address to retrieve data for.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional configuration options for pagination and ordering.
+The object data corresponding to the provided address.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching object data by object address
const objectData = await aptos.getObjectDataByObjectAddress({
objectAddress: "0x1", // replace with a real object address
});
console.log(objectData);
}
runExample().catch(console.error);
+
+
+Retrieves the digital assets owned by a specified address.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the response.
+The address of the owner.
+GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddress.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the digital assets owned by the specified address
const digitalAssets = await aptos.getOwnedDigitalAssets({
ownerAddress: "0x1", // replace with a real account address
});
console.log(digitalAssets);
}
runExample().catch(console.error);
+
+
+Retrieve the owner address of a specified domain name or subdomain name from the contract.
+The arguments for retrieving the owner address.
+A string representing the name of the domain or subdomain to retrieve the owner address for.
+AccountAddress if the name is owned, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the owner address of "test.aptos"
const owner = await aptos.getOwnerAddress({ name: "test.aptos" });
console.log(owner); // Logs the owner address or undefined if not owned
}
runExample().catch(console.error);
+
+
+Fetches the pepper from the Aptos pepper service API.
+The arguments for fetching the pepper.
+Optional
derivationA derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults +to "m/44'/637'/0'/0'/0".
+The EphemeralKeyPair used to generate the nonce in the JWT token.
+JWT token.
+The pepper which is a Uint8Array of length 31.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair
const jwt = "your_jwt_token"; // replace with a real JWT token
// Fetching the pepper using the provided JWT and ephemeral key pair
const pepper = await aptos.getPepper({
jwt,
ephemeralKeyPair,
// derivationPath: "m/44'/637'/0'/0'/0" // specify your own if needed
});
console.log("Fetched pepper:", pepper);
}
runExample().catch(console.error);
+
+
+Retrieve the primary name for an account. An account can have multiple names, but only one primary name, which may not exist.
+The arguments for retrieving the primary name.
+An AccountAddressInput (address) of the account.
+A string if the account has a primary name, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the primary name for the specified account address
const name = await aptos.getPrimaryName({ address: "0x1" }); // replace with a real account address
console.log(name);
}
runExample().catch(console.error);
+
+
+Query the processor status for a specific processor type.
+The processor type to query.
+The status of the specified processor type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the processor status for the account transactions processor
const status = await aptos.getProcessorStatus("account_transactions_processor");
console.log(status);
}
runExample().catch(console.error);
+
+
+Fetches a proof from the Aptos prover service API.
+The arguments for fetching the proof.
+The EphemeralKeyPair used to generate the nonce in the JWT token.
+JWT token.
+Optional
pepper?: HexInputThe pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.
+Optional
uidA key in the JWT token to use to set the uidVal in the IdCommitment.
+The proof which is represented by a ZeroKnowledgeSig.
+import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const jwt = "your_jwt_token"; // replace with a real JWT token
const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair
// Fetch the proof using the getProof function
const proof = await aptos.getProof({
jwt,
ephemeralKeyPair,
pepper: await getPepper({}), // fetch the pepper if not provided
uidKey: "sub", // specify the uid key
});
console.log("Fetched proof:", proof);
}
runExample().catch(console.error);
+
+
+Returns a signing message for a transaction, allowing a user to sign it using their preferred method before submission to the network.
+The arguments for obtaining the signing message.
+A raw transaction for signing elsewhere.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const transaction = await aptos.transaction.build.simple({
sender: "0x1", // replace with a real sender address
data: {
function: "0x1::aptos_account::transfer",
functionArguments: ["0x2", 100], // replace with a real destination address
},
});
const message = await aptos.getSigningMessage({ transaction });
console.log(message);
}
runExample().catch(console.error);
+
+
+Queries for a specific item in a table identified by the handle and the key for the item. +This function allows you to retrieve structured data from a table in the Aptos blockchain.
+Object that describes the table item, including key and value types.
+A pointer to where that table is stored.
+Optional
options?: LedgerVersionArgTable item value rendered in JSON.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve a table item from the Aptos blockchain
const tableItem = await aptos.getTableItem({
handle: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca",
data: {
key_type: "address", // Move type of table key
value_type: "u128", // Move type of table value
key: "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key
},
});
console.log(tableItem);
}
runExample().catch(console.error);
+
+
+Queries for table items data with optional filtering and pagination. +This function allows you to retrieve specific data from a table based on provided criteria.
+The arguments for querying table items data.
+Optional
minimumOptional minimum ledger version to wait for before querying.
+Optional
options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<{ Optional parameters for pagination and filtering.
+GetTableItemsDataResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve table items data with specific filtering options
const data = await aptos.getTableItemsData({
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
options: {
where: {
table_handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" },
transaction_version: { _eq: "0" }
},
limit: 10, // specify your own limit if needed
},
});
console.log(data);
}
runExample().catch(console.error);
+
+
+Queries for the metadata of table items, allowing for filtering and pagination.
+The parameters for the query.
+Optional
minimumOptional minimum ledger version to wait for before querying.
+Optional
options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<{ Optional parameters for pagination and filtering.
+GetTableItemsMetadataResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching table items metadata with a filter condition
const data = await aptos.getTableItemsMetadata({
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
options: {
where: { handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" } },
limit: 10, // specify your own limit if needed
},
});
console.log(data);
}
runExample().catch(console.error);
+
+
+Retrieve the target address of a domain or subdomain name, which indicates the address the name points to for use on-chain. +Note that the target address can point to addresses that do not own the name.
+The arguments for retrieving the target address.
+A string representing the name, which can be a primary name, a subdomain, or a combination (e.g., +"primary", "primary.apt", "secondary.primary", "secondary.primary.apt").
+AccountAddress if the name has a target, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the target address for the specified domain name
const targetAddr = await aptos.getTargetAddress({ name: "test.aptos" });
console.log(targetAddr); // Logs the target address, e.g., 0x123...
}
runExample().catch(console.error);
+
+
+Queries on-chain transactions by their transaction hash, returning both pending and committed transactions.
+The transaction from the mempool (pending) or the on-chain (committed) transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch a transaction by its hash
const transaction = await aptos.getTransactionByHash({ transactionHash: "0x123" }); // replace with a real transaction hash
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Queries on-chain transaction by version. This function will not return pending transactions.
+On-chain transaction. Only on-chain transactions have versions, so this +function cannot be used to query pending transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching a transaction by its version
const transaction = await aptos.getTransactionByVersion({ ledgerVersion: 1 }); // replace 1 with a real version
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Queries on-chain transactions, excluding pending transactions. +Use this function to retrieve historical transactions from the blockchain.
+Optional
args: { Optional parameters for pagination.
+Optional
options?: PaginationArgsOptional pagination options.
+An array of on-chain transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch transactions with pagination
const transactions = await aptos.getTransactions({
options: {
offset: 0, // Start from the first transaction
limit: 10, // Limit to 10 results
},
});
console.log(transactions);
}
runExample().catch(console.error);
+
+
+Defines if the specified transaction is currently in a pending state. +This function helps you determine the status of a transaction using its hash.
+true
if the transaction is in a pending state and false
otherwise.
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Check if the transaction is pending using its hash
const isPendingTransaction = await aptos.isPendingTransaction({ transactionHash: "0x123" }); // replace with a real transaction hash
console.log("Is the transaction pending?", isPendingTransaction);
}
runExample().catch(console.error);
+
+
+Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.
+The authentication key for which to look up the account address.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: LedgerVersionArgPromise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Look up the original account address for a given authentication key
const accountAddress = await aptos.lookupOriginalAccountAddress({
authenticationKey: "0x1", // replace with a real authentication key
});
console.log("Original Account Address:", accountAddress);
}
runExample().catch(console.error);
+
+
+Create a transaction to mint a digital asset into the creator's account within an existing collection. +This function helps you generate a transaction that can be simulated or submitted to the blockchain for minting a digital asset.
+The name of the collection the digital asset belongs to.
+The creator of the collection.
+The description of the digital asset.
+The name of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction generation options.
+Optional
propertyOptional array of property keys for the digital asset.
+Optional
propertyOptional array of property types for the digital asset.
+Optional
propertyOptional array of property values for the digital asset.
+The URI to additional info about the digital asset.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Creating a transaction to mint a digital asset
const transaction = await aptos.mintDigitalAssetTransaction({
creator: Account.generate(), // replace with a real account
collection: "MyCollection",
description: "This is a digital asset.",
name: "MyDigitalAsset",
uri: "https://example.com/my-digital-asset",
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Mint a soul bound digital asset into a recipient's account. +This function allows you to create a unique digital asset that is bound to a specific account.
+The arguments for minting the soul bound transaction.
+The account that mints the digital asset.
+The collection name that the digital asset belongs to.
+The digital asset description.
+The digital asset name.
+Optional
options?: InputGenerateTransactionOptionsAdditional options for generating the transaction.
+Optional
propertyThe property keys for storing on-chain properties.
+Optional
propertyThe type of property values.
+Optional
propertyThe property values to be stored on-chain.
+The account address where the digital asset will be created.
+The digital asset URL.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Mint a soul bound digital asset
const transaction = await aptos.mintSoulBoundTransaction({
account: Account.generate(), // Replace with a real account
collection: "collectionName",
description: "collectionDescription",
name: "digitalAssetName",
uri: "digital-asset-uri.com",
recipient: "0x123" // Replace with a real recipient account address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Generates a transaction to publish a Move package to the blockchain. +This function helps you create a transaction that can be simulated or submitted to the chain for publishing a package.
+To get the metadataBytes
and byteCode
, can compile using Aptos CLI with command
+aptos move compile --save-metadata ...
,
https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module
+The arguments for publishing the package.
+The publisher account.
+The package metadata bytes.
+An array of the bytecode of each module in the package in compiler output order.
+Optional
options?: InputGenerateTransactionOptionsOptional settings for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Replace with a real account address
const account = "0x1";
const metadataBytes = "0x..."; // replace with real metadata bytes
const byteCode = "0x..."; // replace with real module bytecode
const transaction = await aptos.publishPackageTransaction({
account,
metadataBytes,
moduleBytecode: [byteCode],
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Retrieves data from the Aptos Indexer using a GraphQL query. +This function allows you to execute complex queries to fetch specific data from the Aptos blockchain.
+The provided T type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Querying the Aptos Indexer for ledger information
const topUserTransactions = await aptos.queryIndexer({
query: `query MyQuery {
ledger_infos {
chain_id
}
}`
});
console.log(topUserTransactions);
}
runExample().catch(console.error);
+
+
+Registers a new name.
+This function allows you to register a domain or subdomain name with specific expiration policies and options.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Registering a subdomain name assuming def.apt is already registered and belongs to the sender alice.
const txn = await aptos.registerName({
sender: "0x1", // replace with a real sender account
name: "test.aptos.apt",
expiration: {
policy: "subdomain:independent",
expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000, // expires in 30 days
},
});
console.log("Transaction:", txn);
}
runExample().catch(console.error);
+
+
+Remove a digital asset property from the blockchain. +This function allows you to delete an existing property associated with a digital asset.
+The parameters required to remove the digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Remove a digital asset property
const transaction = await aptos.removeDigitalAssetPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Renews a domain name for one year. +If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.
+The arguments for renewing the domain.
+A string representing the domain to renew. Subdomains cannot be renewed.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction options.
+The sender account, which must be the domain owner.
+Optional
years?: 1The number of years to renew the name. Currently, only one year is permitted.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Renew the domain "test" for one year
const transaction = await aptos.renewDomain({
sender: Account.generate(), // replace with a real account
name: "test"
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Rotate an account's authentication key. After rotation, only the new private key can be used to sign transactions for the account. +Note: Only legacy Ed25519 scheme is supported for now. +More info: https://aptos.dev/guides/account-management/key-rotation/
+The arguments for rotating the auth key.
+The account to rotate the auth key for.
+The new private key to rotate to.
+PendingTransactionResponse
+import { Aptos, AptosConfig, Network, Account, PrivateKey } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Rotate the authentication key for an account
const response = await aptos.rotateAuthKey({
// replace with a real account
fromAccount: Account.generate(),
// replace with a real private key
toNewPrivateKey: new PrivateKey("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"),
});
console.log(response);
}
runExample().catch(console.error);
+
+
+Set the digital asset description to provide additional context or information about the asset.
+The parameters for setting the digital asset description.
+The creator account responsible for the digital asset.
+The digital asset description to be set.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the digital asset description
const transaction = await aptos.setDigitalAssetDescriptionTransaction({
creator: Account.generate(), // replace with a real account
description: "This is a digital asset description.",
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Set the digital asset name, allowing you to define a name for a specific digital asset on the blockchain.
+The parameters for setting the digital asset name.
+The creator account responsible for the transaction.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset, represented as a Move struct ID.
+The desired name for the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the blockchain.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const creator = Account.generate(); // Generate a new account for the creator
const digitalAssetAddress = "0x123"; // replace with a real digital asset address
// Set the digital asset name
const transaction = await aptos.setDigitalAssetNameTransaction({
creator: creator,
name: "digitalAssetName",
digitalAssetAddress: digitalAssetAddress,
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Set the URI for a digital asset, allowing you to associate a unique identifier with the asset.
+The parameters for the transaction.
+The creator account initiating the transaction.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The digital asset URI to be set.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the URI for a digital asset
const transaction = await aptos.setDigitalAssetURITransaction({
creator: Account.generate(), // Replace with a real creator account
uri: "digital-asset-uri.com",
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Sets the primary name for the sender account, allowing them to designate a single primary name among potentially multiple +names. An account may not have a primary name.
+The arguments for setting the primary name.
+Optional
name?: stringA string representing the name to set as primary (e.g., "test.aptos").
+Optional
options?: InputGenerateTransactionOptionsOptional transaction options.
+The sender account.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the primary name for the sender account
const sender = Account.generate(); // replace with a real account
await aptos.setPrimaryName({ sender, name: "test.aptos" });
const primaryName = await aptos.getPrimaryName({ address: sender.accountAddress });
console.log("Primary Name:", primaryName); // Should log: "Primary Name: test.aptos"
}
runExample().catch(console.error);
+
+
+Sets the target address of a domain or subdomain name, pointing it to a specified address for use on-chain. +The target address can be different from the owner of the name.
+The arguments for setting the target address.
+The AccountAddressInput of the address to set the domain or subdomain to.
+A string representing the domain or subdomain name (e.g., "test.aptos").
+Optional
options?: InputGenerateTransactionOptionsOptional settings for generating the transaction.
+The account initiating the transaction.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Setting the target address for a domain name
const sender = Account.generate(); // replace with a real account
const address = "0x1"; // replace with a real account address
await aptos.setTargetAddress({
sender: sender,
name: "test.aptos",
address: address,
});
const targetAddress = await aptos.getTargetAddress({ name: "test.aptos" });
console.log(targetAddress); // Should log the address set for "test.aptos"
}
runExample().catch(console.error);
+
+
+Sign a transaction that can later be submitted to the chain. +This function is essential for ensuring the authenticity of the transaction by using the provided account's signing capabilities.
+The arguments for signing the transaction.
+The account that will sign the transaction.
+A raw transaction to sign.
+AccountAuthenticator - The authenticator for the signed transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for signing
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [ "0x1", 100 ], // replace with a real account address and amount
},
});
const signedTransaction = await aptos.transaction.sign({
signer: sender,
transaction,
}); // Sign the transaction
console.log("Signed Transaction:", signedTransaction);
}
runExample().catch(console.error);
+
+
+Sign and submit a single signer transaction as the fee payer to chain given an authenticator by the sender of the transaction.
+The fee payer account to sign the transaction
+The AccountAuthenticator signed by the sender of the transaction
+An instance of a RawTransaction, plus optional secondary/fee payer addresses
+PendingTransactionResponse
+const transaction = await aptos.transaction.build.simple({sender: alice.accountAddress, feePayer: true ...})
const senderAuthenticator = alice.signTransactionWithAuthenticator(transaction)
const pendingTransaction = await aptos.signAndSubmitAsFeePayer({
senderAuthenticator,
feePayer: bob,
transaction,
})
+
+
+Sign and submit a single signer transaction to the blockchain. +This function allows you to execute a transaction after signing it with the specified account.
+The arguments for signing and submitting the transaction.
+PendingTransactionResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for sending the transaction
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [ "0x1", 100 ], // replace with a real account address
},
});
// Sign and submit the transaction
const pendingTransaction = await aptos.signAndSubmitTransaction({
signer: sender,
transaction,
});
console.log(pendingTransaction);
}
runExample().catch(console.error);
+
+
+Sign a transaction as a fee payer that can later be submitted to the chain. +This function ensures that the transaction is marked with the fee payer's address, allowing it to be processed correctly.
+The arguments for signing the transaction.
+The fee payer signer account.
+A raw transaction to sign on. This transaction must include a feePayerAddress
property.
AccountAuthenticator - The authenticator for the signed transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for the fee payer
const transaction = await aptos.transaction.build.simple({
// All transactions on Aptos are implemented via smart contracts.
function: "0x1::aptos_account::transfer",
functionArguments: [sender.accountAddress, 100],
feePayerAddress: sender.accountAddress, // Set the fee payer address
});
const signedTransaction = await aptos.transaction.signAsFeePayer({
signer: sender,
transaction,
});
console.log("Signed transaction as fee payer:", signedTransaction);
}
runExample().catch(console.error);
+
+
+Generate a transfer coin transaction that can be simulated, signed, and submitted. +This function helps you create a transaction to transfer a specified amount of coins +from one account to another within the Aptos network.
+The arguments for the transfer transaction.
+The amount of coins to transfer.
+Optional
coinOptional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The recipient account address.
+The sender account address.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Generate a transfer coin transaction
const transaction = await aptos.transferCoinTransaction({
sender: "0x1", // replace with a real sender account address
recipient: "0x2", // replace with a real recipient account address
amount: 10,
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Transfer ownership of a non-fungible digital asset. +This function allows you to transfer a digital asset only if it is not frozen, meaning the ownership transfer is not disabled.
+The arguments for transferring the digital asset.
+The address of the digital asset being transferred.
+Optional
digitalOptional. The type of the digital asset, defaults to "0x4::token::Token".
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The account address of the recipient.
+The sender account of the current digital asset owner.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Transfer a digital asset
const transaction = await aptos.transferDigitalAssetTransaction({
sender: Account.generate(), // replace with a real sender account
digitalAssetAddress: "0x123", // replace with a real digital asset address
recipient: "0x456", // replace with a real recipient account address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Transfer a specified amount of fungible asset from the sender's primary store to the recipient's primary store. +This method allows you to transfer any fungible asset, including fungible tokens.
+The arguments for the transfer operation.
+The number of assets to transfer.
+The fungible asset account address. For example, if you’re transferring USDT, +this would be the USDT address.
+Optional
options?: InputGenerateTransactionOptionsOptional parameters for generating the transaction.
+The recipient account address.
+The sender account.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Transfer fungible asset from sender to recipient
const transaction = await aptos.transferFungibleAsset({
sender: Account.generate(), // replace with a real sender account
fungibleAssetMetadataAddress: "0x123", // replace with a real fungible asset address
recipient: "0x456", // replace with a real recipient account
amount: 5
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Unfreeze the ability to transfer a digital asset. +This function allows the specified creator account to unfreeze the transfer of a digital asset identified by its address.
+The parameters for unfreezing the digital asset transfer.
+The creator account that is unfreezing the digital asset transfer.
+The address of the digital asset to unfreeze.
+Optional
digitalOptional. The type of the digital asset being unfrozen.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Unfreeze the ability to transfer a digital asset
const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({
creator: Account.generate(), // replace with a real creator account
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Update a digital asset property on-chain.
+The parameters for updating the digital asset property.
+The account that mints the digital asset.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Update a digital asset property
const transaction = await aptos.updateDigitalAssetPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: false,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Update a typed digital asset property on-chain. +This function allows you to modify the properties of a digital asset, enabling dynamic updates to its attributes.
+The arguments for updating the digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digital(Optional) The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptions(Optional) Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Update a typed digital asset property
const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "typedKey",
propertyType: "U8",
propertyValue: 2,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+This installs a set of FederatedJWKs at an address for a given iss.
+It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address +to reflect it.
+the iss claim of the federated OIDC provider.
+Optional
jwksthe URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.
+Optional
options?: InputGenerateTransactionOptionsThe account that will install the JWKs
+The pending transaction that results from submission.
+Queries for a Move view function
+Optional
options?: LedgerVersionArgPayload for the view function
+an array of Move values
+Queries for a Move view function with JSON, this provides compatability with the old aptos
package
Optional
options?: LedgerVersionArgPayload for the view function
+an array of Move values
+Waits for a transaction to move past the pending state and provides the transaction response. +There are 4 cases.
+checkSuccess
is true, the function will throw a FailedTransactionError
+If checkSuccess
is false, the function will resolve with the transaction response where the success
field is false.args.options.timeoutSecs
seconds.
+Optional
options?: WaitForTransactionOptionsOptional parameters for waiting behavior.
+The hash of a transaction previously submitted to the blockchain.
+The transaction on-chain response.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Wait for a transaction to complete using its hash
const transactionHash = "0x123"; // replace with a real transaction hash
const transactionResponse = await aptos.waitForTransaction({
transactionHash,
options: {
timeoutSecs: 30, // specify your own timeout if needed
checkSuccess: true,
},
});
console.log(transactionResponse);
}
runExample().catch(console.error);
+
+
+Represents an error returned from the Aptos API. +This class encapsulates the details of the error, including the request URL, response status, and additional data.
+Readonly
dataReadonly
requestOptional
stackReadonly
statusReadonly
statusReadonly
urlStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackRepresents the configuration settings for an Aptos SDK client instance. +This class allows customization of various endpoints and client settings.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for connecting to the Aptos testnet
const config = new AptosConfig({ network: Network.TESTNET });
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Initializes an instance of the Aptos client with the specified settings. +This allows users to configure various aspects of the client, such as network and endpoints.
+Optional
settings: AptosSettingsOptional configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client with default settings
const config = new AptosConfig({ network: Network.TESTNET }); // Specify the network
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Returns the URL endpoint to send the request to based on the specified API type. +If a custom URL was provided in the configuration, that URL is returned. Otherwise, the URL endpoint is derived from the network.
+The type of Aptos API to get the URL for. This can be one of the following: FULLNODE, FAUCET, INDEXER, PEPPER, PROVER.
+import { Aptos, AptosConfig, Network, AptosApiType } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Getting the request URL for the FULLNODE API
const url = config.getRequestUrl(AptosApiType.FULLNODE);
console.log("Request URL for FULLNODE:", url);
}
runExample().catch(console.error);
+
+
+Checks if the provided URL is a known pepper service endpoint.
+The URL to check against the known pepper service endpoints.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const url = "https://example.pepper.service"; // replace with a real pepper service URL
// Check if the URL is a known pepper service endpoint
const isPepperService = config.isPepperServiceRequest(url);
console.log(`Is the URL a known pepper service? ${isPepperService}`);
}
runExample().catch(console.error);
+
+
+Checks if the provided URL is a known prover service endpoint.
+The URL to check against known prover service endpoints.
+A boolean indicating whether the URL is a known prover service endpoint.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
// Check if the URL is a known prover service endpoint
const url = "https://prover.testnet.aptos.dev"; // replace with a real URL if needed
const isProver = config.isProverServiceRequest(url);
console.log(`Is the URL a known prover service? ${isProver}`);
+
+
+Readonly
clientThe client instance the SDK uses. Defaults to `@aptos-labs/aptos-client
+Optional
Readonly
clientOptional client configurations
+Optional
Readonly
faucetThe optional hardcoded faucet URL to send requests to instead of using the network
+Optional
Readonly
faucetOptional specific Faucet configurations
+Optional
Readonly
fullnodeThe optional hardcoded fullnode URL to send requests to instead of using the network
+Optional
Readonly
fullnodeOptional specific Fullnode configurations
+Optional
Readonly
indexerThe optional hardcoded indexer URL to send requests to instead of using the network
+Optional
Readonly
indexerOptional specific Indexer configurations
+Readonly
networkThe Network that this SDK is associated with. Defaults to DEVNET
+Optional
Readonly
pepperThe optional hardcoded pepper service URL to send requests to instead of using the network
+Optional
Readonly
proverThe optional hardcoded prover service URL to send requests to instead of using the network
+Represents an authentication key used for account management. Each account stores an authentication key that enables account +owners to rotate their private key(s) without changing the address that hosts their account. The authentication key is a +SHA3-256 hash of data and is always 32 bytes in length.
+Creates an instance of the AuthenticationKey using the provided hex input. +This ensures that the hex input is valid and conforms to the required length for an Authentication Key.
+Derives an account address from an AuthenticationKey by translating the AuthenticationKey bytes directly to an AccountAddress.
+AccountAddress - The derived account address.
+Serializes the fixed bytes data into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserialize an AuthenticationKey from the byte buffer in a Deserializer instance.
+The deserializer to deserialize the AuthenticationKey from.
+An instance of AuthenticationKey.
+Static
fromConverts a PublicKey to an AuthenticationKey using the derivation scheme inferred from the provided PublicKey instance.
+The arguments for the function.
+The PublicKey to be converted.
+AuthenticationKey - The derived AuthenticationKey.
+Static
fromDerives an AuthenticationKey from the provided public key using a specified derivation scheme.
+The arguments for deriving the authentication key.
+The public key used for the derivation.
+The scheme to use for deriving the authentication key.
+Static
fromGenerates an AuthenticationKey from the specified scheme and input bytes. +This function is essential for creating a valid authentication key based on a given scheme.
+The arguments for generating the AuthenticationKey.
+The input data in hexadecimal format to derive the key.
+The authentication key scheme to use.
+An instance of AuthenticationKey containing the generated key data.
+Represents a boolean value that can be serialized and deserialized. +This class extends the Serializable class and provides methods to serialize +the boolean value for different contexts, such as entry functions and script functions.
+Deserializes a U256 value from the provided deserializer.
+The deserializer instance used to read the U256 data.
+Serializes the value using the provided serializer. +This function is essential for converting the value into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Serializes the current instance for use in an entry function by converting it to a byte sequence. +This allows the instance to be properly formatted for serialization in transactions.
+The serializer instance used to serialize the byte sequence.
+Serializes the current instance for use in a script function. +This allows for the conversion of the instance into a format suitable for transmission or storage.
+The serializer used to perform the serialization.
+Static
deserializeRepresents a ChainId that can be serialized and deserialized.
+Serializes the current object using the provided serializer. +This function helps in converting the object into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes a ChainId from the provided deserializer. +This function allows you to reconstruct a ChainId object from serialized data.
+The deserializer instance used to read the serialized data.
+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.
+Creates a new instance of the class with a copy of the provided data buffer. +This prevents outside mutation of the buffer.
+The data to be copied into the internal buffer as a Uint8Array.
+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)
.
The BCS-deserializable class to deserialize the buffered bytes into.
+the deserialized value of class type T
+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.
+The deserialized array of bytes.
+Deserializes an optional value from the buffer.
+The BCS layout for Optional
Either a Deserializable class or one of the string literals: "string", "bytes", or "fixedBytes"
+The deserialized value if present, undefined otherwise
+// 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]
+
+
+use deserializeOption
instead.
+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.
+Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.
+The BCS-deserializable class to deserialize the buffered bytes into.
+An array of deserialized values of type T.
+// serialize a vector of addresses
const addresses = new Array<AccountAddress>(
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
+
+
+Represents an Ed25519 account that provides signing capabilities through an Ed25519 private key. +This class allows for the creation of accounts, signing messages and transactions, and verifying signatures.
+Note: Generating an instance of this class does not create the account on-chain.
+Creates an instance of the Ed25519Signer with the specified parameters. +This constructor initializes the private key, public key, and account address for the signer.
+The constructor arguments for the Ed25519Signer.
+Sign the given message using the account's Ed25519 private key.
+The message to be signed in HexInput format.
+Signature - The resulting signature of the signed message.
+Sign the given transaction using the available signing capabilities. +This function helps ensure that the transaction is properly authenticated before submission.
+The transaction to be signed.
+Signature - The resulting signature for the transaction.
+Sign a transaction using the account's Ed25519 private key. +This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.
+The raw transaction to be signed.
+An AccountAuthenticator containing the signature and the public key.
+Sign a message using the account's Ed25519 private key. +This function returns an AccountAuthenticator containing the signature along with the account's public key.
+The signing message, represented as hexadecimal input.
+An AccountAuthenticator containing the signature and the account's public key.
+Verify the given message and signature with the public key.
+The arguments for verifying the signature.
+A boolean indicating whether the signature is valid.
+Static
fromDerives an Ed25519 account using a specified BIP44 path and mnemonic seed phrase.
+The arguments for deriving the account.
+Static
generateGenerates a new Ed25519 account using a randomly generated private key. +This function is useful for creating a signer that can be used for cryptographic operations.
+The newly generated Ed25519 account.
+Represents the private key of an Ed25519 key pair.
+Create a new PrivateKey instance from a Uint8Array or String.
+ +HexInput (string or Uint8Array)
+Optional
strict: booleanIf true, private key must AIP-80 compliant.
+Derive the Ed25519PublicKey for this private key.
+Ed25519PublicKey - The derived public key corresponding to the private key.
+Sign the given message with the private key. +This function generates a digital signature for the specified message, ensuring its authenticity and integrity.
+A message as a string or Uint8Array in HexInput format.
+A digital signature for the provided message.
+Static
deserializeStatic
fromDerives a private key from a mnemonic seed phrase using a specified BIP44 path. +To derive multiple keys from the same phrase, change the path
+IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.
+The BIP44 path used for key derivation.
+The mnemonic seed phrase from which the key will be derived.
+Static
generateGenerate a new random private key.
+Ed25519PrivateKey A newly generated Ed25519 private key.
+Static
isDetermines if the provided private key is an instance of Ed25519PrivateKey.
+The private key to check.
+A boolean indicating whether the private key is an Ed25519PrivateKey.
+Static
Readonly
LENGTHLength of an Ed25519 private key
+Static
Readonly
SLIP_The Ed25519 key seed to use for BIP-32 compatibility +See more https://github.com/satoshilabs/slips/blob/master/slip-0010.md
+Represents the public key of an Ed25519 key pair.
+Since AIP-55 Aptos supports
+Legacy
and Unified
authentication keys.
Ed25519 scheme is represented in the SDK as Legacy authentication key
and also
+as AnyPublicKey
that represents any Unified authentication key
.
Creates an instance of the Ed25519Signature class from a hex input. +This constructor validates the length of the signature to ensure it meets the required specifications.
+The hex input representing the Ed25519 signature.
+Generates an authentication key from the public key using the Ed25519 scheme. +This function is essential for creating a secure authentication key that can be used for further cryptographic operations.
+The generated authentication key.
+Serializes the data into a byte array using the provided serializer. +This allows for the conversion of data into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Verifies a signed message using a public key.
+The arguments for verification.
+Static
deserializeDeserialize bytes into an Ed25519Signature object. +This function is used to convert serialized byte data into a usable Ed25519Signature instance.
+The deserializer instance used to read the byte data.
+Static
isDetermines if the provided public key is a valid Ed25519 public key. +This function checks for the presence of the "key" property and verifies that its data length matches the expected length +for Ed25519 public keys.
+The public key to validate.
+A boolean indicating whether the public key is a valid Ed25519 public key.
+Static
isDetermine if the provided public key is an instance of Ed25519PublicKey.
+The public key to check.
+True if the public key is an instance of Ed25519PublicKey, otherwise false.
+Represents a signature of a message signed using an Ed25519 private key.
+Static
deserializeRepresents an entry function that can be serialized and deserialized. +This class encapsulates the details required to invoke a function within a module, +including the module name, function name, type arguments, and function arguments.
+Contains the payload to run a function within a module.
+Fully qualified module name in format "account_address::module_name" e.g. "0x1::coin"
+The function name. e.g "transfer"
+Type arguments that move function requires.
+arguments to the move function.
+Static
buildBuild an EntryFunction payload from raw primitive values.
+Fully qualified module name in the format "AccountAddress::module_id", e.g., "0x1::coin".
+The name of the function to be called.
+Type arguments that the Move function requires.
+Arguments to the Move function.
+EntryFunction
+A coin transfer function has one type argument "CoinType".
+public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)
+
+
+A coin transfer function has three arguments "from", "to", and "amount".
+public(script) fun transfer<CoinType>(from: &signer, to: address, amount: u64)
+
+
+Static
deserializeDeserializes an entry function payload with the arguments represented as EntryFunctionBytes instances.
+A deserialized EntryFunction payload for a transaction.
+EntryFunctionBytes
+NOTE: When you deserialize an EntryFunction payload with this method, the entry function +arguments are populated into the deserialized instance as type-agnostic, raw fixed bytes +in the form of the EntryFunctionBytes class.
+In order to correctly deserialize these arguments as their actual type representations, you +must know the types of the arguments beforehand and deserialize them yourself individually.
+One way you could achieve this is by using the ABIs for an entry function and deserializing each +argument as its given, corresponding type.
+This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because +serializing an entry function appends a prefix that's only used for entry function arguments.
+NOTE: Using this class for serialized script functions will lead to erroneous and unexpected behavior.
+If you wish to convert this class back to a TransactionArgument, you must know the type +of the argument beforehand, and use the appropriate class to deserialize the bytes within +an instance of this class.
+Serializes the value using the provided serializer. +This function is essential for accurately representing a sequence of bytes that are already BCS-serialized as a type.
+Note that to see the Move, BCS-serialized representation of the underlying fixed byte vector, +we must not serialize the length prefix.
+The serializer instance used to perform the serialization.
+Serializes the current instance for use as an entry function argument by converting the underlying fixed byte vector to a +type-agnostic byte vector. +This process includes serializing the length prefix of the byte vector.
+The serializer instance used to perform the serialization.
+Static
deserializeThe only way to create an instance of this class is to use this static method. +This function should only be used when deserializing a sequence of EntryFunctionPayload arguments.
+The deserializer instance with the buffered bytes.
+The length of the bytes to deserialize.
+An instance of this class, which will now only be usable as an EntryFunctionArgument.
+Represents an ephemeral certificate containing a signature, specifically a ZeroKnowledgeSig. +This class can be extended to support additional signature types, such as OpenIdSignature.
+Static
deserializeRepresents an ephemeral key pair used for signing transactions via the Keyless authentication scheme. +This key pair is temporary and includes an expiration time. +For more details on how this class is used, refer to the documentation: +https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui
+Creates an instance of the class with a specified private key, optional expiry date, and optional blinder. +This constructor initializes the public key, sets the expiry date to a default value if not provided, +generates a blinder if not supplied, and calculates the nonce based on the public key, expiry date, and blinder.
+The parameters for constructing the instance.
+Optional
blinder?: HexInputOptional blinder value. If not provided, a new blinder will be generated.
+Optional
expiryOptional expiry date in seconds from the current time. Defaults to two weeks from now.
+The private key used for creating the instance.
+Returns the public key of the key pair.
+EphemeralPublicKey
+Serializes the object's properties into a format suitable for transmission or storage. +This function is essential for preparing the object data for serialization processes.
+The serializer instance used to serialize the object's properties.
+Sign the given data using the private key, returning an ephemeral signature. +This function is essential for creating a secure signature that can be used for authentication or verification purposes.
+The data to be signed, provided in HexInput format.
+EphemeralSignature - The resulting ephemeral signature.
+Static
deserializeDeserializes an ephemeral key pair from the provided deserializer. +This function helps in reconstructing an ephemeral key pair, which is essential for cryptographic operations.
+The deserializer instance used to read the serialized data.
+Static
fromDeserialize a byte array into an EphemeralKeyPair object. +This function allows you to reconstruct an EphemeralKeyPair from its serialized byte representation.
+The byte array representing the serialized EphemeralKeyPair.
+Static
generateGenerates a new ephemeral key pair with an optional expiry date. +This function allows you to create a temporary key pair for secure operations.
+Optional
args: { Optional parameters for key pair generation.
+Optional
expiryThe date of expiry for the key pair in seconds.
+Optional
scheme?: Ed25519The type of key pair to use for the EphemeralKeyPair. Only Ed25519 is supported for now.
+An instance of EphemeralKeyPair containing the generated private key and expiry date.
+Readonly
blinderA byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP. +Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.
+Readonly
expiryA timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new +EphemeralKeyPair must be generated and a new JWT needs to be created.
+Readonly
nonceThe value passed to the IdP when the user authenticates. It consists of a hash of the +ephemeral public key, expiry date, and blinder.
+Static
Readonly
BLINDER_Represents ephemeral public keys for Aptos Keyless accounts.
+These keys are used only temporarily within Keyless accounts and are not utilized as public keys for account identification.
+Creates an instance of EphemeralPublicKey using the provided public key. +This constructor ensures that only supported signature types are accepted.
+The public key to be used for the ephemeral public key.
+Serializes the current instance, specifically handling the Ed25519 signature type. +This function ensures that the signature is properly serialized using the provided serializer.
+The serializer instance used to serialize the signature.
+Verifies a signed message using the ephemeral public key.
+The arguments for the verification.
+The message that was signed.
+The signature that was signed by the private key of the ephemeral public key.
+true if the signature is valid, otherwise false.
+Static
deserializeDeserializes an EphemeralSignature from the provided deserializer. +This function allows you to retrieve an EphemeralSignature based on the deserialized data.
+The deserializer instance used to read the serialized data.
+Static
isDetermines if the provided public key is an instance of EphemeralPublicKey
.
The public key to check.
+A boolean indicating whether the public key is an ephemeral type.
+Represents ephemeral signatures used in Aptos Keyless accounts.
+These signatures are utilized within the KeylessSignature framework.
+Static
deserializeStatic
fromDeserializes an ephemeral signature from a hexadecimal input. +This function allows you to convert a hexadecimal representation of an ephemeral signature into its deserialized form for +further processing.
+The hexadecimal input representing the ephemeral signature.
+Account implementation for the FederatedKeyless authentication scheme.
+Used to represent a FederatedKeyless based account and sign transactions with it.
+Use FederatedKeylessAccount.create()
to instantiate a KeylessAccount with a JSON Web Token (JWT), proof, EphemeralKeyPair and the
+address the JSON Web Key Set (JWKS) are installed that will be used to verify the JWT.
When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, +EphemeralKeyPair, and corresponding proof.
+Validates that the Keyless Account can be used to sign transactions.
+This initializes the asynchronous proof fetch.
+Emits whether the proof succeeds or fails, but has no return.
+Serializes the transaction data into a format suitable for transmission or storage. +This function ensures that both the transaction bytes and the proof are properly serialized.
+The serializer instance used to convert the transaction data into bytes.
+Sign the given message using Keyless.
+in HexInput format
+Signature
+Sign the given transaction with Keyless. +Signs the transaction and proof to guard against proof malleability.
+the transaction to be signed
+KeylessSignature
+Sign a transaction using Keyless.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using Keyless.
+the message to sign, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
+Verifies a signature given the message.
+TODO: Groth16 proof verification
+the message that was signed.
+the KeylessSignature to verify
+boolean
+Static
createCreates a KeylessAccount instance using the provided parameters. +This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT. +This is used instead of the KeylessAccount constructor.
+The parameters for creating a KeylessAccount.
+Optional
address?: AccountAddressOptional account address associated with the KeylessAccount.
+The ephemeral key pair used in the account creation.
+The address which stores the JSON Web Key Set (JWKS) used to verify the JWT.
+A JSON Web Token used for authentication.
+A Zero Knowledge Signature or a promise that resolves to one.
+Optional
proofOptional callback function for fetching proof.
+Optional
uidOptional key for user identification, defaults to "sub".
+Optional
verificationStatic
deserializeDeserializes the provided deserializer to create a KeylessAccount instance. +This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.
+The deserializer instance used to retrieve the serialized data.
+A KeylessAccount instance created from the deserialized data.
+Static
fetchJWKFetches the JWK from the issuer's well-known JWKS endpoint.
+The kid of the JWK to fetch
+The keyless public key to query
+A JWK matching the kid
in the JWT header.
Static
fromDeserialize bytes using this account's information.
+The bytes being interpreted.
+Static
partialOptional
verificationReadonly
accountAccount address associated with the account
+Readonly
audThe value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's +OIDC registration with the identity provider.
+Readonly
ephemeralThe EphemeralKeyPair used to generate sign.
+Readonly
jwtThe JWT token used to derive the account
+Readonly
pepperA value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
+The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
+Readonly
proofThe proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on +fetching the proof.
+Readonly
publicThe FederatedKeylessPublicKey associated with the account
+Readonly
signingSigning scheme used to sign transactions
+Readonly
uidThe claim on the JWT to identify a user. This is typically 'sub' or 'email'.
+Readonly
uidThe value of the uidKey claim on the JWT. This intended to be a stable user identifier.
+Optional
Readonly
verificationThe hash of the verification key used to verify the proof. This is optional and can be used to check verifying key +rotations which may invalidate the proof.
+Static
Readonly
PEPPER_Represents the FederatedKeylessPublicKey public key
+These keys use an on-chain address as a source of truth for the JWK used to verify signatures.
+FederatedKeylessPublicKey authentication key is represented in the SDK as AnyPublicKey
.
Get the authentication key for the federated keyless public key
+AuthenticationKey
+Verifies a signed data with a public key
+message
+The signature
+true if the signature is valid
+Static
createCreates a FederatedKeylessPublicKey from the JWT components plus pepper
+the client ID of the application
+the iss of the identity
+The pepper used to maintain privacy of the account
+the key to use to get the uidVal in the JWT token
+the value of the uidKey in the JWT token
+FederatedKeylessPublicKey
+Static
deserializeStatic
fromOptional
uidStatic
isStatic
isRepresents a Fee Payer Transaction that can be serialized and deserialized.
+Serialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Static
loadRepresents a contiguous sequence of already serialized BCS bytes.
+This class differs from most other Serializable classes in that its internal byte buffer is serialized to BCS
+bytes exactly as-is, without prepending the length of the bytes. It is ideal for scenarios where custom serialization
+is required, such as passing serialized bytes as transaction arguments. Additionally, it serves as a representation
+of type-agnostic BCS bytes, akin to a vector
An example use case includes handling bytes resulting from entry function arguments that have been serialized +for an entry function.
+const yourCustomSerializedBytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
const fixedBytes = new FixedBytes(yourCustomSerializedBytes);
const payload = await generateTransactionPayload({
function: "0xbeefcafe::your_module::your_function_that_requires_custom_serialization",
functionArguments: [yourCustomBytes],
});
This class is particularly useful when you want to handle a fixed-size byte array without the overhead of
length prepending, such as when dealing with 32-byte addresses stored as U8 in a MoveVector<U8>.
For example, if you store each of the 32 bytes for an address as a U8 in a MoveVector<U8>, when you
serialize that MoveVector<U8>, it will be serialized to 33 bytes. If you solely want to pass around
the 32 bytes as a Serializable class that *does not* prepend the length to the BCS-serialized representation,
use this class.*
+
+
+Creates an instance of the class with a specified hexadecimal input. +The value is converted from hexadecimal format to a Uint8Array.
+The hexadecimal input to be converted.
+Serializes the fixed bytes value using the provided serializer. +This function is essential for converting the fixed bytes into a format suitable for storage or transmission.
+The serializer instance used for serialization.
+Serializes the current instance for an entry function using the provided serializer. +This allows the instance to be converted into a format suitable for transmission or storage.
+The serializer used to perform the serialization.
+Serializes the current instance using the provided serializer. +This function is essential for preparing data to be passed as arguments in script functions.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes a fixed-length byte array from the provided deserializer. +This function helps in reconstructing a FixedBytes object from the serialized data.
+The deserializer instance used to read the byte data.
+The length of the byte array to be deserialized.
+Represents the verification key stored on-chain used to verify Groth16 proofs.
+Static
fromConverts a Groth16VerificationKeyResponse object into a Groth16VerificationKey instance.
+The Groth16VerificationKeyResponse object containing the verification key data.
+A Groth16VerificationKey instance constructed from the provided response data.
+Readonly
alphaThe alpha * G
, where G
is the generator of G1
Readonly
betaThe alpha * H
, where H
is the generator of G2
Readonly
deltaThe delta * H
, where H
is the generator of G2
Readonly
gammaThe gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H
, where H is the generator of G1
Readonly
gammaThe gamma * H
, where H
is the generator of G2
Represents a Groth16 zero-knowledge proof, consisting of three proof points in compressed serialization format. +The points are the compressed serialization of affine representation of the proof.
+Static
deserializeNOTE: Do not use this class when working with account addresses; use AccountAddress instead. +When accepting hex data as input to a function, prefer to accept HexInput and
+A helper class for working with hex data. Hex data, when represented as a string, +generally looks like this, for example: 0xaabbcc, 45cd32, etc.
+then use the static helper methods of this class to convert it into the desired +format. This enables the greatest flexibility for the developer.
+Example usage:
+getTransactionByHash(txnHash: HexInput): Promise<Transaction> {
const txnHashString = Hex.fromHexInput(txnHash).toString();
return await getTransactionByHashInner(txnHashString);
}
+
+
+This call to Hex.fromHexInput().toString()
converts the HexInput to a hex string
+with a leading 0x prefix, regardless of what the input format was.
Other ways to chain the functions together:
+Hex.fromHexString({ hexInput: "0x1f" }).toUint8Array()
new Hex([1, 3]).toStringWithoutPrefix()
Determine if two Hex instances are equal by comparing their underlying byte data.
+The Hex instance to compare to.
+true if the Hex instances are equal, false if not.
+Static
fromConverts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance. +This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.
+A HexInput which can be a string or Uint8Array.
+A Hex instance created from the provided hexInput.
+Static
fromStatic
hexConverts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.
+The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
+A hex string with '0x' prefix (e.g., "0x1234")
+Static
hexConverts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.
+The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array
+A hex string without '0x' prefix (e.g., "1234")
+Static
hexConverts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.
+A HexInput which can be a string or Uint8Array.
+A Uint8Array created from the provided hexInput.
+Static
isCheck if the provided string is a valid hexadecimal representation.
+A hex string representing byte data.
+An object containing:
+Represents an Identifier that can be serialized and deserialized. +This class is used to denote the module "name" in "ModuleId" and +the "function name" in "EntryFunction".
+Creates an instance of the class with a specified identifier.
+The unique identifier for the instance.
+Serializes the identifier of the current instance using the provided serializer.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes an identifier from the provided deserializer. +This function is useful for reconstructing an Identifier object from a serialized format.
+The deserializer instance used to read the serialized data.
+Account implementation for the Keyless authentication scheme.
+Used to represent a Keyless based account and sign transactions with it.
+Use KeylessAccount.create()
to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.
When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, +EphemeralKeyPair, and corresponding proof.
+Validates that the Keyless Account can be used to sign transactions.
+This initializes the asynchronous proof fetch.
+Emits whether the proof succeeds or fails, but has no return.
+Serializes the transaction data into a format suitable for transmission or storage. +This function ensures that both the transaction bytes and the proof are properly serialized.
+The serializer instance used to convert the transaction data into bytes.
+Sign the given message using Keyless.
+in HexInput format
+Signature
+Sign the given transaction with Keyless. +Signs the transaction and proof to guard against proof malleability.
+the transaction to be signed
+KeylessSignature
+Sign a transaction using Keyless.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using Keyless.
+the message to sign, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
+Verifies a signature given the message.
+TODO: Groth16 proof verification
+the message that was signed.
+the KeylessSignature to verify
+boolean
+Static
createCreates a KeylessAccount instance using the provided parameters. +This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT. +This is used instead of the KeylessAccount constructor.
+The parameters for creating a KeylessAccount.
+Optional
address?: AccountAddressOptional account address associated with the KeylessAccount.
+The ephemeral key pair used in the account creation.
+A JSON Web Token used for authentication.
+A hexadecimal input used for additional security.
+A Zero Knowledge Signature or a promise that resolves to one.
+Optional
proofOptional callback function for fetching proof.
+Optional
uidOptional key for user identification, defaults to "sub".
+Optional
verificationStatic
deserializeDeserializes the provided deserializer to create a KeylessAccount instance. +This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.
+The deserializer instance used to retrieve the serialized data.
+A KeylessAccount instance created from the deserialized data.
+Static
fetchJWKFetches the JWK from the issuer's well-known JWKS endpoint.
+The kid of the JWK to fetch
+The keyless public key to query
+A JWK matching the kid
in the JWT header.
Static
fromDeserialize bytes using this account's information.
+The bytes being interpreted.
+Static
partialOptional
verificationReadonly
accountAccount address associated with the account
+Readonly
audThe value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's +OIDC registration with the identity provider.
+Readonly
ephemeralThe EphemeralKeyPair used to generate sign.
+Readonly
jwtThe JWT token used to derive the account
+Readonly
pepperA value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
+The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
+Readonly
proofThe proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on +fetching the proof.
+Readonly
publicThe KeylessPublicKey associated with the account
+Readonly
signingSigning scheme used to sign transactions
+Readonly
uidThe claim on the JWT to identify a user. This is typically 'sub' or 'email'.
+Readonly
uidThe value of the uidKey claim on the JWT. This intended to be a stable user identifier.
+Optional
Readonly
verificationThe hash of the verification key used to verify the proof. This is optional and can be used to check verifying key +rotations which may invalidate the proof.
+Static
Readonly
PEPPER_Represents the on-chain configuration for how Keyless accounts operate.
+Static
createStatic
captureStatic
constructOptional
innerError: unknownOptional
details: stringStatic
fromStatic constructor that creates a KeylessError instance using the KeylessErrors constant
+Optional
details?: stringoptional details to include in the error message
+Optional
error?: unknownThe type of KeylessError
+A new KeylessError instance
+Readonly
categoryOptional
Readonly
detailsOptional
Readonly
innerReadonly
resolutionOptional
stackReadonly
typeStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackRepresents a Keyless Public Key used for authentication.
+This class encapsulates the public key functionality for keyless authentication,
+including methods for generating and verifying signatures, as well as serialization
+and deserialization of the key. The KeylessPublicKey is represented in the SDK
+as AnyPublicKey
.
Constructs an instance with the specified parameters for cryptographic operations.
+Get the authentication key for the keyless public key.
+AuthenticationKey - The authentication key derived from the keyless public key.
+Serializes the current instance into a format suitable for transmission or storage. +This function ensures that all relevant fields are properly serialized, including the proof and optional fields.
+The serializer instance used to perform the serialization.
+Verifies the validity of a signature for a given message.
+The arguments for signature verification.
+The message that was signed.
+The signature to verify against the message.
+true if the signature is valid; otherwise, false.
+Static
createCreates a KeylessPublicKey from the JWT components plus pepper
+the client ID of the application
+the iss of the identity
+The pepper used to maintain privacy of the account
+the key to use to get the uidVal in the JWT token
+the value of the uidKey in the JWT token
+KeylessPublicKey
+Static
deserializeDeserializes a ZeroKnowledgeSig object from the provided deserializer. +This function allows you to reconstruct a ZeroKnowledgeSig instance from its serialized form.
+The deserializer instance used to read the serialized data.
+A new instance of ZeroKnowledgeSig.
+Static
fromCreates a KeylessPublicKey instance from a JWT and a pepper value. +This function is useful for generating a public key that can be used for authentication based on the provided JWT claims and pepper.
+The arguments for creating the KeylessPublicKey.
+The JSON Web Token to decode.
+The pepper value used in the key creation process.
+Optional
uidAn optional key to retrieve the unique identifier from the JWT payload, defaults to "sub".
+A KeylessPublicKey instance created from the provided JWT and pepper.
+Static
isChecks if the provided public key is a valid instance by verifying its structure and types.
+The public key to validate.
+A boolean indicating whether the public key is a valid instance.
+Static
isDetermines if the provided public key is an instance of KeylessPublicKey.
+The public key to check.
+A boolean indicating whether the public key is a KeylessPublicKey instance.
+Static
loadLoads a KeylessPublicKey instance from the provided deserializer. +This function is used to deserialize the necessary components to create a KeylessPublicKey.
+The deserializer used to extract the string and byte data.
+A new instance of KeylessPublicKey.
+Readonly
idA value representing a cryptographic commitment to a user identity.
+It is calculated from the aud, uidKey, uidVal, pepper.
+Readonly
issThe value of the 'iss' claim on the JWT which identifies the OIDC provider.
+Static
Readonly
ID_The number of bytes that idCommitment
should be
Represents a signature of a message signed via a Keyless Account, utilizing proofs or a JWT token for authentication.
+Static
deserializeStatic
getStatic
isReadonly
ephemeralThe inner signature ZeroKnowledgeSignature or OpenIdSignature
+Readonly
ephemeralThe ephemeral public key used to verify the signature
+Readonly
ephemeralThe signature resulting from signing with the private key of the EphemeralKeyPair
+Readonly
expiryThe expiry timestamp in seconds of the EphemeralKeyPair used to sign
+Readonly
jwtThe jwt header in the token used to create the proof/signature. In json string representation.
+Represents a ModuleId that can be serialized and deserialized. +A ModuleId consists of a module address (e.g., "0x1") and a module name (e.g., "coin").
+Initializes a new instance of the module with the specified account address and name.
+The account address, e.g., "0x1".
+The module name under the specified address, e.g., "coin".
+Serializes the address and name properties using the provided serializer. +This function is essential for converting the object's data into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes a ModuleId from the provided deserializer. +This function retrieves the account address and identifier to construct a ModuleId instance.
+The deserializer instance used to read the data.
+Static
fromThis class serves as a base class for all serializable types. It facilitates +composable serialization of complex types and enables the serialization of +instances to their BCS (Binary Canonical Serialization) representation.
+Static
deserializeStatic
fromRepresents an argument for entry functions, providing methods to serialize the argument +to BCS-serialized bytes and convert it to different formats.
+Optional
value: null | TSerialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Static
BoolFactory method to generate a MoveOptionboolean
or undefined
.
Optional
value: null | booleanthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
deserializeStatic
MoveFactory method to generate a MoveOptionstring
or undefined
.
Optional
value: null | stringthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U128Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U16Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U256Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U32Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U64Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U8Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Represents a string value that can be serialized and deserialized. +This class extends the Serializable base class and provides methods +for serializing the string in different contexts, such as for entry +functions and script functions.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeThis class is the Aptos Typescript SDK representation of a Move vector<T>
,
+where T
represents either a primitive type (bool
, u8
, u64
, ...)
+or a BCS-serializable struct itself.
It is a BCS-serializable, array-like type that contains an array of values of type T
,
+where T
is a class that implements Serializable
.
The purpose of this class is to facilitate easy construction of BCS-serializable
+Move vector<T>
types.
// in Move: `vector<u8> [1, 2, 3, 4];`
const vecOfU8s = new MoveVector<U8>([new U8(1), new U8(2), new U8(3), new U8(4)]);
// in Move: `std::bcs::to_bytes(vector<u8> [1, 2, 3, 4]);`
const bcsBytes = vecOfU8s.toUint8Array();
// vector<vector<u8>> [ vector<u8> [1], vector<u8> [1, 2, 3, 4], vector<u8> [5, 6, 7, 8] ];
const vecOfVecs = new MoveVector<MoveVector<U8>>([
new MoveVector<U8>([new U8(1)]),
MoveVector.U8([1, 2, 3, 4]),
MoveVector.U8([5, 6, 7, 8]),
]);
// vector<Option<u8>> [ std::option::some<u8>(1), std::option::some<u8>(2) ];
const vecOfOptionU8s = new MoveVector<MoveOption<U8>>([
MoveOption.U8(1),
MoveOption.U8(2),
]);
// vector<MoveString> [ std::string::utf8(b"hello"), std::string::utf8(b"world") ];
const vecOfStrings = new MoveVector([new MoveString("hello"), new MoveString("world")]);
const vecOfStrings2 = MoveVector.MoveString(["hello", "world"]);
+
+
+Initializes a new instance of the class with an optional value. +This constructor sets up the internal vector based on the provided value.
+The initial value to be stored in the vector, or null to initialize an empty vector.
+Serializes the current object using the provided serializer. +This function will serialize the value if it is present.
+The serializer instance used to perform the serialization.
+Serializes the current instance into a byte sequence suitable for entry functions. +This allows the data to be properly formatted for transmission or storage.
+The serializer instance used to serialize the byte sequence.
+Serialize the string as a fixed byte string without the length prefix for use in a script function.
+The serializer used to convert the byte vector into a format suitable for a script function.
+Static
BoolFactory method to generate a MoveVectorboolean
or undefined
.
+This method allows you to create an optional boolean value that can be used in various contexts where a boolean may or may
+not be present.
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome() method
+will return false.
A MoveVectorvalue
.
Static
deserializeDeserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.
+NOTE: This only works with a depth of one. Generics will not work.
+NOTE: This will not work with types that aren't of the Serializable class.
+If you're looking for a more flexible deserialization function, you can use the deserializeVector function +in the Deserializer class.
+the Deserializer instance to use, with bytes loaded into it already.
+the class to typecast the input values to, must be a Serializable and Deserializable type.
+a MoveVector of the corresponding class T
+Static
MoveFactory method to generate a MoveVectorstring
or undefined
.
+This function creates a MoveVector that encapsulates a MoveString if the provided value is not null or undefined.
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome() method
+will return false.
A MoveVectorvalue
.
Static
U128Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome()
+method will return false.
A MoveVectorvalue
.
Static
U16Factory method to generate a MoveOptionnumber
or null
.
This method allows you to create a MoveVector that can either hold a U16 value or be empty.
+The value used to fill the MoveVector. If value
is null or undefined, the resulting MoveVector's
+.isSome()
method will return false.
A MoveVectorvalue
.
Static
U256Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined or null,
+the resulting MoveVector's .isSome() method will return false.
A MoveVectorvalue
.
Static
U32Factory method to generate a MoveVectornumber
or null
.
This method allows you to create a MoveVector that can either hold a U32 value or be empty.
+The value used to fill the MoveVector. If value
is null or undefined,
+the resulting MoveVector's .isSome() method will return false.
A MoveVectorvalue
.
Static
U64Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined or null, the resulting MoveVector's
+.isSome()
method will return false.
A MoveVectorvalue
.
Static
U8Factory method to generate a MoveVectornumber
or undefined
.
This method allows you to create a MoveVector that encapsulates a U8 value, enabling you to handle optional U8 values +effectively.
+The values used to fill the MoveVector. If values
is undefined or null, the resulting MoveVector's
+.isSome()
method will return false.
A MoveVectorvalue
.
Represents a multi-agent transaction that can be serialized and deserialized.
+Serialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Static
loadDeserializes a Fee Payer Raw Transaction from the provided deserializer. +This function allows you to reconstruct a Fee Payer Raw Transaction object, which includes the raw transaction data, +secondary signer addresses, and the fee payer address.
+The deserializer used to read the raw transaction data.
+A FeePayerRawTransaction object constructed from the deserialized data.
+Represents a multi-agent transaction that can be serialized and deserialized. +This transaction includes a raw transaction, optional fee payer address, and multiple secondary signer addresses.
+Represents a MultiAgentTransaction that can be submitted to the Aptos chain for execution. +This class encapsulates the raw transaction data, the secondary signer addresses, and an optional fee payer address.
+The raw transaction data.
+An array of secondary signer addresses.
+Optional
feePayerAddress: AccountAddressAn optional account address that sponsors the gas fees.
+Serializes the transaction data, including the raw transaction, secondary signer addresses, and fee payer address. +This function is essential for preparing the transaction for transmission or storage in a serialized format.
+The serializer instance used to serialize the transaction data.
+Static
deserializeDeserializes a MultiAgentTransaction from the provided deserializer. +This function allows you to reconstruct a MultiAgentTransaction object from its serialized form, including any secondary +signer addresses and the fee payer address if present.
+The deserializer instance used to read the serialized data.
+Represents the public key of a K-of-N Ed25519 multi-sig transaction.
+A K-of-N multi-sig transaction requires at least K out of N authorized signers to sign the transaction +for it to be executed. This class encapsulates the logic for managing the public keys and the threshold +for valid signatures.
+Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a +transaction to be executed, at least K out of the N authorized signers have signed the transaction +and passed the check conducted by the chain.
+A wrapper to let you choose the param order.
+A list of public keys
+At least "threshold" signatures must be valid
+Generates an authentication key based on the current instance's byte representation. +This function is essential for creating a secure authentication key that can be used for various cryptographic operations.
+The generated authentication key.
+Serializes the current instance into bytes using the provided serializer. +This allows for the conversion of the instance's data into a format suitable for transmission or storage.
+The serializer used to convert the instance into bytes.
+Verifies a multi-signature against a given message. +This function ensures that the provided signatures meet the required threshold and are valid for the given message.
+The arguments for verifying the signature.
+True if the signature is valid; otherwise, false.
+Static
deserializeDeserializes a MultiEd25519Signature from the provided deserializer. +This function helps in reconstructing a MultiEd25519Signature object from its serialized byte representation.
+The deserializer instance used to read the serialized data.
+Readonly
publicList of Ed25519 public keys for this LegacyMultiEd25519PublicKey
+Readonly
thresholdThe minimum number of valid signatures required, for the number of public keys specified
+Static
Readonly
MAX_Maximum number of public keys supported
+Static
Readonly
MIN_Minimum number of public keys needed
+Static
Readonly
MIN_Minimum threshold for the number of valid signatures required
+Represents the signature of a K-of-N Ed25519 multi-sig transaction.
+Signature for a K-of-N multi-sig transaction.
+4 bytes, at most 32 signatures are supported. If Nth bit value is 1
, the Nth
+signature should be provided in signatures
. Bits are read from left to right.
+Alternatively, you can specify an array of bitmap positions.
+Valid position should range between 0 and 31.
A list of signatures
+Static
createHelper method to create a bitmap out of the specified bit positions. +This function allows you to set specific bits in a 32-bit long bitmap based on the provided positions.
+The arguments for creating the bitmap.
+The bitmap positions that should be set. A position starts at index 0. Valid positions should range between 0 and 31.
+bitmap that is 32 bits long.
+Static
deserializeReadonly
bitmap32-bit Bitmap representing who signed the transaction
+This is represented where each public key can be masked to determine whether the message was signed by that key.
+Readonly
signaturesThe list of underlying Ed25519 signatures
+Static
BITMAP_Number of bytes in the bitmap representing who signed the transaction (32-bits)
+Static
MAX_Maximum number of Ed25519 signatures supported
+Represents a multi-key authentication scheme for accounts, allowing multiple public keys +to be associated with a single account. This class enforces a minimum number of valid signatures +required to authorize actions, ensuring enhanced security for multi-agent accounts.
+The public keys of each individual agent can be any type of public key supported by Aptos.
+Since AIP-55, Aptos supports
+Legacy
and Unified
authentication keys.
Generates an authentication key based on the current instance's byte representation. +This key can be used for secure authentication processes within the system.
+The generated authentication key.
+Get the index of the provided public key.
+This function retrieves the index of a specified public key within the MultiKey. +If the public key does not exist, it throws an error.
+The public key to find the index for.
+The corresponding index of the public key, if it exists.
+Serializes the object by writing its signatures and bitmap to the provided serializer. +This allows the object to be converted into a format suitable for transmission or storage.
+The serializer instance used to perform the serialization.
+Verifies the provided signature against the given message. +This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.
+The arguments for verifying the signature.
+Static
deserializeDeserializes a MultiKeySignature from the provided deserializer. +This function retrieves the signatures and bitmap necessary for creating a MultiKeySignature object.
+The deserializer instance used to read the serialized data.
+Static
isSigner implementation for the MultiKey authentication scheme.
+This account utilizes an M of N signing scheme, where M and N are specified in the MultiKey. +It signs messages using an array of M accounts, each corresponding to a public key in the MultiKey.
+Note: Generating a signer instance does not create the account on-chain.
+Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions.
+The arguments for creating a MultiKeyAccount.
+Optional
address?: AccountAddressInputAn optional account address input. If not provided, the derived address from the public key will be used.
+The multikey of the account consisting of N public keys and a number M representing the required signatures.
+An array of M signers that will be used to sign the transaction.
+Validates that the Keyless Account can be used to sign transactions.
+Sign the given message using the MultiKeyAccount's signers
+MultiKeySignature
+Sign the given transaction using the MultiKeyAccount's signers. +This function aggregates signatures from all signers associated with the MultiKeyAccount.
+The transaction to be signed.
+MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures.
+Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the +account's public key.
+The raw transaction to be signed.
+An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key.
+Sign a message using the account's signers and return an AccountAuthenticator containing the signature along with the +account's public key.
+The signing message, represented as binary input in hexadecimal format.
+An instance of AccountAuthenticatorMultiKey that includes the signature and the public key.
+Verify the given message and signature with the public keys.
+This function checks if the provided signatures are valid for the given message using the corresponding public keys.
+The arguments for verifying the signature.
+A boolean indicating whether the signatures are valid for the message.
+Static
fromStatic constructor to create a MultiKeyAccount using the provided public keys and signers.
+MultiKeyAccount - The newly created MultiKeyAccount.
+Static
isDetermines if the provided account is a multi-key account.
+The account to check.
+A boolean indicating whether the account is a multi-key account.
+Readonly
accountAccount address associated with the account
+Readonly
publicPublic key associated with the account
+Readonly
signaturesReadonly
signerAn array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in +publicKey.publicKeys. Used to derive the right public key to use for verification.
+Readonly
signersThe signers used to sign messages. These signers should correspond to public keys in the +MultiKeyAccount's public key. The number of signers should be equal or greater +than this.publicKey.signaturesRequired
+Readonly
signingSigning scheme used to sign transactions
+Represents a multi-signature transaction using Ed25519 signatures. +This class allows for the creation and management of a K-of-N multi-signature scheme, +where a specified number of signatures are required to authorize a transaction.
+It includes functionality to validate the number of signatures against a bitmap, +which indicates which public keys have signed the transaction.
+Signature for a K-of-N multi-sig transaction.
+4 bytes, at most 32 signatures are supported. If Nth bit value is 1
, the Nth
+signature should be provided in signatures
. Bits are read from left to right
A list of signatures
+Static
createHelper method to create a bitmap out of the specified bit positions
+The bitmap positions that should be set. A position starts at index 0. +Valid position should range between 0 and 31.
+bitmap that is 32bit long
+Static
deserializeReadonly
bitmap32-bit Bitmap representing who signed the transaction
+This is represented where each public key can be masked to determine whether the message was signed by that key.
+Readonly
signaturesThe list of underlying Ed25519 signatures
+Static
BITMAP_Number of bytes in the bitmap representing who signed the transaction (32-bits)
+Static
MAX_Maximum number of Ed25519 signatures supported
+Represents a MultiSig account that can be serialized and deserialized.
+This class encapsulates the functionality to manage multi-signature transactions, including the address of the +multi-sig account and the associated transaction payload.
+Contains the payload to run a multi-sig account transaction.
+The multi-sig account address the transaction will be executed as.
+Optional
transaction_payload: MultiSigTransactionPayloadThe payload of the multi-sig transaction. This is optional when executing a multi-sig +transaction whose payload is already stored on chain.
+Static
deserializeRepresents a multi-signature transaction payload that can be serialized and deserialized.
+This class is designed to encapsulate the transaction payload for multi-sig account transactions
+as defined in the multisig_account.move
module. Future enhancements may allow support for script
+payloads as the multisig_account.move
module evolves.
Contains the payload to run a multi-sig account transaction.
+The payload of the multi-sig transaction. +This can only be EntryFunction for now but, +Script might be supported in the future.
+Static
deserializeThis error is used to explain why parsing failed.
+Creates an instance of the error with a specified message and invalid reason.
+The error message that describes the issue.
+The reason why the input is considered invalid.
+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.
+Optional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
formatFormat a HexInput to an AIP-80 compliant string.
+ +The HexString or Uint8Array format of the private key.
+Static
parseParse a HexInput that may be a HexString, Uint8Array, or a AIP-80 compliant string to a Hex instance.
+ +A HexString, Uint8Array, or a AIP-80 compliant string.
+Optional
strict: booleanIf true, the value MUST be compliant with AIP-80.
+Abstract
Represents an abstract public key.
+This class provides a common interface for verifying signatures associated with the public key. +It allows for the retrieval of the raw public key bytes and the public key in a hexadecimal string format.
+Abstract
serializeAbstract
verifyVerifies that the private key associated with this public key signed the message with the given signature.
+Represents a raw transaction that can be serialized and deserialized. +Raw transactions contain the metadata and payloads that can be submitted to the Aptos chain for execution. +They must be signed before the Aptos chain can execute them.
+RawTransactions contain the metadata and payloads that can be submitted to Aptos chain for execution. +RawTransactions must be signed before Aptos chain can execute them.
+The sender Account Address
+Sequence number of this transaction. This must match the sequence number stored in +the sender's account at the time the transaction executes.
+Instructions for the Aptos Blockchain, including publishing a module, +execute an entry function or execute a script payload.
+Maximum total gas to spend for this transaction. The account must have more +than this gas or the transaction will be discarded during validation.
+Price to be paid per gas unit.
+The blockchain timestamp at which the blockchain would discard this transaction.
+The chain ID of the blockchain that this transaction is intended to be run on.
+Serializes the transaction data, including the fee payer transaction type, raw transaction, secondary signer addresses, +and fee payer address. +This function is essential for preparing the transaction for transmission or storage in a serialized format.
+The serializer instance used to serialize the transaction data.
+Static
deserializeDeserialize a Raw Transaction With Data. +This function retrieves the appropriate raw transaction based on the variant index provided by the deserializer.
+An instance of the Deserializer used to read the serialized data.
+Abstract
Represents a raw transaction with associated data that can be serialized and deserialized.
+Abstract
serializeSerialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Represents a challenge required for the account owner to sign in order to rotate the authentication key.
+Initializes a new instance of the class with the specified parameters. +This constructor sets up the necessary attributes for managing account keys.
+The parameters required to create the instance.
+The current authentication key of the account.
+The new public key to be set for the account.
+The account address of the originator.
+The sequence number associated with the transaction.
+Serializes the properties of the current instance for transmission or storage. +This function helps in converting the instance data into a format suitable for serialization.
+The serializer used to serialize the instance properties.
+Represents a Script that can be serialized and deserialized. +Scripts contain the Move bytecode payload that can be submitted to the Aptos chain for execution.
+Scripts contain the Move bytecodes payload that can be submitted to Aptos chain for execution.
+The move module bytecode
+The type arguments that the bytecode function requires.
+The arguments that the bytecode function requires.
+Static
deserializeRepresents a Secp256k1 ECDSA private key, providing functionality to create, sign messages, +derive public keys, and serialize/deserialize the key.
+Create a new PrivateKey instance from a Uint8Array or String.
+ +A HexInput (string or Uint8Array)
+Optional
strict: booleanIf true, private key must AIP-80 compliant.
+Derive the Secp256k1PublicKey from this private key.
+Secp256k1PublicKey The derived public key.
+Sign the given message with the private key. +This function generates a cryptographic signature for the provided message, ensuring the signature is canonical and non-malleable.
+A message in HexInput format to be signed.
+Signature - The generated signature for the provided message.
+Static
deserializeStatic
fromDerives a private key from a mnemonic seed phrase using a specified BIP44 path.
+The BIP44 path to derive the key from.
+The mnemonic seed phrase used for key generation.
+The generated private key.
+Static
generateGenerate a new random private key.
+Secp256k1PrivateKey - A newly generated Secp256k1 private key.
+Static
isDetermines if the provided private key is an instance of Secp256k1PrivateKey.
+The private key to be checked.
+Represents a Secp256k1 ECDSA public key.
+Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array. +This constructor validates the length of the provided signature data.
+A HexInput (string or Uint8Array) representing the signature data.
+Deserializes a Secp256k1Signature from the provided deserializer. +This function allows you to reconstruct a Secp256k1Signature object from its serialized byte representation.
+The deserializer instance used to read the serialized data.
+Serializes the data into a byte array using the provided serializer. +This function is essential for converting data into a format suitable for transmission or storage.
+The serializer instance used to convert the data.
+Verifies a Secp256k1 signature against the public key.
+This function checks the validity of a signature for a given message, ensuring that the signature is canonical as a malleability check.
+The arguments for verifying the signature.
+Static
deserializeStatic
isDetermines if the provided public key is a valid instance of a Secp256k1 public key. +This function checks for the presence of a "key" property and validates the length of the key data.
+The public key to validate.
+A boolean indicating whether the public key is a valid Secp256k1 public key.
+Static
isDetermine if the provided public key is an instance of Secp256k1PublicKey.
+The public key to check.
+Represents a signature of a message signed using a Secp256k1 ECDSA private key.
+Create a new Signature instance from a Uint8Array or String.
+A HexInput (string or Uint8Array)
+Static
deserializeAbstract
This class serves as a base class for all serializable types. It facilitates +composable serialization of complex types and enables the serialization of +instances to their BCS (Binary Canonical Serialization) representation.
+Abstract
serializeRepresents a serialized data structure that encapsulates a byte array. +This class extends the Serializable class and provides methods for serialization +and deserialization of byte data, as well as converting to a MoveVector.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Deserialize the bytecode into a MoveVector of the specified type. +This function allows you to convert serialized data into a usable MoveVector format.
+The class type of the elements in the MoveVector.
+Static
deserializeA 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.
+Constructs a serializer with a buffer of size length
bytes, 64 bytes by default.
+The length
must be greater than 0.
The size of the buffer in bytes.
+Serializes a Serializable
value, facilitating composable serialization.
The Serializable value to serialize.
+the serializer instance
+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.
+The byte array to serialize.
+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.
+The Uint8Array to be serialized.
+Serializes an optional value which can be a Serializable, string, or Uint8Array. +For strings and Uint8Arrays, it uses the appropriate serialization method.
+Optional
value: TThe value to serialize (Serializable, string, Uint8Array, or undefined)
+Optional
len: numberOptional fixed length for Uint8Array serialization. If provided, uses serializeFixedBytes instead of serializeBytes
+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
+
+
+Optional
value: stringThe optional string to serialize. If undefined, it will serialize as 0.
+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
+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.
+The string to serialize.
+Serializes a U128 value into a format suitable for storage or transmission.
+The U128 value to serialize, represented as a number.
+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.
+The U256 value to serialize, represented as an AnyNumber.
+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
+The 32-bit unsigned integer value to be serialized.
+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.
+The 64-bit unsigned integer to serialize, represented as a number.
+Serializes an array of BCS Serializable values to a serializer instance. +The bytes are added to the serializer instance's byte buffer.
+The array of BCS Serializable values
+const addresses = new Array<AccountAddress>(
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<address> [@0x1, @0x2, @0xa, @0xb])`;
+
+
+Abstract
An abstract representation of a crypto signature, +associated with a specific signature scheme, e.g., Ed25519 or Secp256k1.
+This class represents the product of signing a message directly from a +PrivateKey and can be verified against a CryptoPublicKey.
+Abstract
serializeRepresents a signed transaction that includes a raw transaction and an authenticator. +The authenticator contains a client's public key and the signature of the raw transaction.
+Represents a signed transaction that includes a raw transaction and an authenticator. +The authenticator contains a client's public key and the signature of the raw transaction, +which can be of three types: single signature, multi-signature, and multi-agent.
+The raw transaction to be signed.
+Contains a client's public key and the signature of the raw transaction. The authenticator has 3 +flavors: single signature, multi-signature and multi-agent.
+Serializes the raw transaction and its authenticator using the provided serializer. +This function is essential for preparing the transaction data for transmission or storage.
+The serializer instance used to serialize the transaction and authenticator.
+Static
deserializeDeserializes a signed transaction from the provided deserializer. +This function allows you to reconstruct a SignedTransaction object from its serialized form, enabling further processing or validation.
+The deserializer instance used to read the serialized data.
+Represents a simple transaction type that can be submitted to the Aptos chain for execution.
+This transaction type is designed for a single signer and includes metadata such as the Raw Transaction +and an optional sponsor Account Address to cover gas fees.
+SimpleTransaction represents a transaction signed by a single account that +can be submitted to the Aptos chain for execution.
+The Raw Transaction.
+Optional
feePayerAddress: AccountAddressThe optional sponsor Account Address to pay the gas fees.
+Serializes the transaction data using the provided serializer. +This function ensures that the raw transaction and fee payer address are properly serialized for further processing.
+The serializer instance used to serialize the transaction data.
+Static
deserializeDeserializes a SimpleTransaction from the given deserializer. +This function helps in reconstructing a SimpleTransaction object from its serialized form.
+The deserializer instance used to read the serialized data.
+Signer implementation for the SingleKey authentication scheme. +This class extends a SingleKeyAccount by adding signing capabilities through a valid private key. +Currently, the only supported signature schemes are Ed25519 and Secp256k1.
+Note: Generating a signer instance does not create the account on-chain.
+Creates an instance of the SingleKeySigner using the provided private key and address. +This allows for signing transactions and messages with the specified private key.
+The constructor arguments for initializing the SingleKeySigner.
+Sign the given message using the account's private key.
+The message to be signed in HexInput format.
+A new AnySignature containing the signature of the message.
+Sign the given transaction using the account's private key. +This function generates a signing message for the transaction and then signs it.
+The transaction to be signed.
+Signature - The resulting signature for the signed transaction.
+Sign a transaction using the account's private key. +This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.
+The raw transaction to be signed.
+An AccountAuthenticatorSingleKey containing the signature of the transaction and the account's public key.
+Sign a message using the account's private key and return an AccountAuthenticator containing the signature along with the +account's public key.
+The signing message, represented as binary input in hexadecimal format.
+An instance of AccountAuthenticatorSingleKey containing the signature and the public key.
+Verify the given message and signature with the public key.
+The arguments for verifying the signature.
+A boolean indicating whether the signature is valid.
+Static
fromDerives an account using a specified BIP44 path and mnemonic seed phrase, defaulting to the Ed25519 signature scheme. +This function allows you to create a single key account based on the provided derivation path and mnemonic.
+The arguments for deriving the account.
+Static
generateDerives an account from a randomly generated private key based on the specified signing scheme. +The default generation scheme is Ed25519, but it can also support Secp256k1Ecdsa.
+The arguments for generating the account.
+An account with the generated private key based on the specified signing scheme.
+Represents a structured tag that includes an address, module name, +name, and type arguments. This class is used to define and manage +structured data types within the SDK.
+Static
deserializeA container class to hold a transaction and a proof. It implements CryptoHashable which is used to create +the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
+Optional
proof: ZkProofSerializes the transaction data into a format suitable for transmission or storage. +This function ensures that both the transaction bytes and the proof are properly serialized.
+The serializer instance used to convert the transaction data into bytes.
+Abstract
Represents an abstract base class for transaction authenticators. +This class provides methods for serializing and deserializing different types of transaction authenticators.
+Abstract
serializeStatic
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Represents a transaction authenticator using Ed25519 for a single signer transaction. +This class encapsulates the client's public key and the Ed25519 signature of a raw transaction.
+Creating a Signed Transaction +for details about generating a signature.
+Creates an instance of the class with the specified account authenticator.
+The Ed25519PublicKey that will be used for authentication.
+The Ed25519Signature that will be used for authentication.
+Serializes the transaction authenticator by encoding the sender information.
+The serializer instance used to perform the serialization.
+Static
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Static
loadLoads a TransactionAuthenticatorSingleSender instance from the provided deserializer. +This function helps in deserializing the sender information to create a transaction authenticator.
+The deserializer used to extract the sender data.
+Represents a transaction authenticator specifically for fee payer transactions. +It encapsulates the sender's account authenticator, addresses of secondary signers, +their respective authenticators, and the fee payer's account information.
+Static
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents a transaction authenticator for a multi-agent transaction.
+This class manages the authentication process involving a primary sender and multiple secondary signers.
+Static
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents a transaction authenticator for multi-signature transactions using Ed25519. +This class is used to validate transactions that require multiple signatures from different signers.
+Static
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents a single sender authenticator for transactions that require a single signer. +This class is responsible for managing the authentication of a transaction initiated by a single sender.
+Static
deserializeDeserializes a TransactionAuthenticator from the provided deserializer. +This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.
+The deserializer instance used to read the serialized data.
+Static
loadAbstract
Represents a supported Transaction Payload that can be serialized and deserialized.
+This class serves as a base for different types of transaction payloads, allowing for +their serialization into a format suitable for transmission and deserialization back +into their original form.
+Abstract
serializeSerialize a Transaction Payload
+Static
deserializeDeserializes a multisig transaction payload from the provided deserializer. +This function enables the reconstruction of a MultiSigTransactionPayload object from its serialized form.
+The deserializer instance used to read the serialized data.
+Represents a transaction payload entry function that can be serialized and deserialized.
+Serialize a Transaction Payload
+Static
deserializeDeserializes a multisig transaction payload from the provided deserializer. +This function enables the reconstruction of a MultiSigTransactionPayload object from its serialized form.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents a multi-signature transaction payload that can be serialized and deserialized.
+Serialize a Transaction Payload
+Static
deserializeDeserializes a multisig transaction payload from the provided deserializer. +This function enables the reconstruction of a MultiSigTransactionPayload object from its serialized form.
+The deserializer instance used to read the serialized data.
+Static
loadRepresents a transaction payload script that can be serialized and deserialized.
+This class encapsulates a script that defines the logic for a transaction payload.
+Initializes a multi-sig account transaction with the provided payload.
+The payload of the multi-sig transaction. This can only be an EntryFunction for now, but Script might be +supported in the future.
+Serializes the transaction payload, enabling future support for multiple types of inner transaction payloads.
+The serializer instance used to serialize the transaction data.
+Static
deserializeDeserializes a multisig transaction payload from the provided deserializer. +This function enables the reconstruction of a MultiSigTransactionPayload object from its serialized form.
+The deserializer instance used to read the serialized data.
+Static
loadLoads a MultiSig transaction payload from the provided deserializer. +This function helps in reconstructing a MultiSig transaction payload from its serialized form.
+The deserializer used to read the serialized data.
+TransactionWorker provides a simple framework for receiving payloads to be processed.
+Once one start()
the process and pushes a new transaction, the worker acquires
+the current account's next sequence number (by using the AccountSequenceNumber class),
+generates a signed transaction and pushes an async submission process into the outstandingTransactions
queue.
+At the same time, the worker processes transactions by reading the outstandingTransactions
queue
+and submits the next transaction to chain, it
Initializes a new instance of the class, providing a framework for receiving payloads to be processed.
+A configuration object for Aptos.
+The account that will be used for sending transactions.
+The maximum wait time to wait before re-syncing the sequence number to the current on-chain state, +default is 30 seconds.
+The maximum number of transactions that can be submitted per account, default is 100.
+The time to wait in seconds before re-evaluating if the maximum number of transactions are in flight, +default is 10 seconds.
+Reads the outstanding transaction queue and submits the transactions to the chain. +This function processes each transaction, checking their status and emitting events based on whether they were successfully +sent or failed.
+Throws an error if the process execution fails. +TransactionWorkerEventsEnum.TransactionSent - Emitted when a transaction has been successfully committed to the chain. +TransactionWorkerEventsEnum.TransactionSendFailed - Emitted when a transaction fails to commit, along with the error +reason. +TransactionWorkerEventsEnum.ExecutionFinish - Emitted when the execution of transactions is complete.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOnce a transaction has been sent to the chain, this function checks for its execution status.
+The transaction that was sent to the chain and is now waiting to be executed.
+The account's sequence number that was sent with the transaction.
+Calls each of the listeners registered for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Return an array listing the events for which the emitter has registered +listeners.
+Generates a signed transaction that can be submitted to the chain.
+An Aptos account used as the sender of the transaction.
+A sequence number the transaction will be generated with.
+A signed transaction object or undefined if the transaction queue is empty.
+Return the number of listeners listening to a given event.
+Return the listeners registered for a given event.
+Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanAdd a listener for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyAdd a one-time listener for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyPushes a transaction to the transactions queue for processing.
+The transaction payload containing necessary details.
+Optional
options: InputGenerateTransactionOptionsOptional parameters for transaction configuration.
+Remove the listeners of a given event.
+Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanSubmits the next transaction for the account by generating it with the current sequence number +and adding it to the outstanding transaction queue for processing. +This function continues to submit transactions until there are no more to process.
+Readonly
accountReadonly
accountReadonly
aptostransactions that have been committed to chain
+signed transactions waiting to be submitted
+transactions that have been submitted to chain
+Readonly
tasktransactions payloads waiting to be generated and signed
+TODO support entry function payload from ABI builder
+Static
prefixedAbstract
Represents a type tag in the serialization framework, serving as a base class for various specific type tags. +This class provides methods for serialization and deserialization of type tags, as well as type checking methods +to determine the specific type of the tag at runtime.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Abstract
serializeAbstract
toStatic
deserializeRepresents a type tag for an address in the system. +This class extends the TypeTag class and provides functionality +to serialize the address type and load it from a deserializer.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a boolean type tag in the type system. +This class extends the base TypeTag class and provides +methods for serialization and deserialization of the boolean +type tag.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Serializes the current instance's properties into a provided serializer. +This function ensures that the address, module name, name, and type arguments are properly serialized.
+The serializer instance used to serialize the properties.
+Static
deserializeStatic
loadDeserializes a StructTag and returns a new TypeTagStruct instance.
+The deserializer used to read the StructTag data.
+Represents a generic type tag used for type parameters in entry functions. +Generics are not serialized into a real type, so they cannot be used as a type directly.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents an error that occurs during the parsing of a type tag. +This error extends the built-in Error class and provides additional context +regarding the specific type tag that failed to parse and the reason for the failure.
+Constructs an error indicating a failure to parse a type tag. +This error provides details about the specific type tag that could not be parsed and the reason for the failure.
+The string representation of the type tag that failed to parse.
+The reason why the type tag is considered invalid.
+Represents a reference to a type tag in the type system. +This class extends the TypeTag class and provides functionality +to serialize and deserialize type tag references.
+Initializes a new instance of the class with the specified parameters.
+The TypeTag to reference.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for a signer in the system. +This class extends the base TypeTag and provides specific functionality +related to the signer type.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a structured type tag in the system, extending the base TypeTag class. +This class encapsulates information about a specific structure, including its address, +module name, and type arguments, and provides methods for serialization and type checking.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the provided address, module name, and struct name match the current type tag.
+The account address to compare against the type tag.
+The name of the module to compare against the type tag.
+The name of the struct to compare against the type tag.
+True if the address, module name, and struct name match the type tag; otherwise, false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for the u128 data type. +This class extends the base TypeTag class and provides methods for serialization and deserialization.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for unsigned 16-bit integers (u16). +This class extends the base TypeTag class and provides methods for serialization and deserialization.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for the U256 data type. +This class extends the base TypeTag class and provides methods for serialization and deserialization.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for a 32-bit unsigned integer (u32). +This class extends the base TypeTag class and provides methods for serialization +and deserialization specific to the u32 type.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for 64-bit unsigned integers (u64). +This class extends the base TypeTag class and provides methods for serialization and deserialization.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a type tag for an 8-bit unsigned integer (u8). +This class extends the base TypeTag class and provides methods +for serialization and deserialization specific to the u8 type.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadRepresents a vector type tag, which encapsulates a single type tag value. +This class extends the base TypeTag class and provides methods for serialization, +deserialization, and string representation of the vector type tag.
+Deserializes a StructTag from the provided deserializer. +This function allows you to reconstruct a StructTag object from its serialized form.
+The deserializer instance used to read the serialized data.
+Determines if the current instance is of type TypeTagAddress.
+True if the instance is a TypeTagAddress, otherwise false.
+Determines if the current instance is of type TypeTagBool.
+True if the instance is a TypeTagBool, otherwise false.
+Determines if the current instance is of type TypeTagGeneric.
+Returns true if the instance is a TypeTagGeneric, otherwise false.
+Determine if the current instance is a TypeTagSigner.
+Returns true if the instance is a TypeTagSigner, otherwise false.
+Determines if the current instance is a structure type.
+True if the instance is of type TypeTagStruct, otherwise false.
+Determines if the current instance is of the TypeTagU128 type.
+True if the instance is of TypeTagU128, otherwise false.
+Checks if the current instance is of type TypeTagU16.
+True if the instance is TypeTagU16, otherwise false.
+Checks if the current instance is of type TypeTagU256.
+Returns true if the instance is of type TypeTagU256, otherwise false.
+Checks if the current instance is of type TypeTagU32.
+Returns true if the instance is TypeTagU32, otherwise false.
+Checks if the current instance is of type TypeTagU64.
+True if the instance is a TypeTagU64, otherwise false.
+Checks if the current instance is a vector type. +This can help determine the specific type of data structure being used.
+True if the instance is of type TypeTagVector, otherwise false.
+Static
deserializeStatic
loadStatic
u8Creates a new TypeTagVector instance with a TypeTagU8 type.
+A new TypeTagVector initialized with TypeTagU8.
+Represents a 128-bit unsigned integer value. +This class provides methods for serialization and deserialization +of U128 values, ensuring that the values are within the valid range.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents a 16-bit unsigned integer (U16) value. +This class extends the Serializable class and provides methods for serialization +and deserialization of the U16 value.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents a 256-bit unsigned integer (U256) that extends the Serializable class. +This class provides methods for serialization and deserialization of U256 values, +ensuring that the values are within the valid range.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents a 32-bit unsigned integer (U32) that can be serialized and deserialized. +This class ensures that the value is within the valid range for a U32.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents a 64-bit unsigned integer (U64) and provides methods for serialization.
+This class ensures that the value is within the valid range for a U64 and provides +functionality to serialize the value for various use cases, including entry functions +and script functions.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents an unsigned 8-bit integer (U8) value. +This class extends the Serializable class and provides methods for serialization and deserialization of U8 values.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Static
deserializeRepresents a zero-knowledge signature, encapsulating the proof and its associated metadata.
+Optional
extraOptional
overrideOptional
trainingStatic
deserializeStatic
fromDeserialize a ZeroKnowledgeSig object from its BCS serialization in bytes.
+The bytes representing the serialized ZeroKnowledgeSig.
+ZeroKnowledgeSig - The deserialized ZeroKnowledgeSig object.
+Readonly
expThe max lifespan of the proof
+Optional
Readonly
extraA key value pair on the JWT token that can be specified on the signature which would reveal the value on chain. +Can be used to assert identity or other attributes.
+Optional
Readonly
overrideThe 'aud' value of the recovery service which is set when recovering an account.
+Readonly
proofThe proof
+Optional
Readonly
trainingThe training wheels signature
+Represents a container for different types of zero-knowledge proofs.
+Static
deserializeA class to handle all ANS
operations.
Initializes a new instance of the Aptos class with the provided configuration. +This allows you to interact with the Aptos blockchain using the specified network settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for connecting to the Aptos testnet
const config = new AptosConfig({ network: Network.TESTNET });
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Fetches all top-level domain names for a specified account.
+The arguments for retrieving account domains.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching all top-level domain names for a specific account
const domains = await aptos.getAccountDomains({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of names to fetch
offset: 0, // specify the offset for pagination
orderBy: "created_at", // specify the order by which to sort the names
where: {
// additional filters can be specified here
},
},
});
console.log(domains);
}
runExample().catch(console.error);
+
+
+Fetches all names for an account, including both top-level domains and subdomains.
+The arguments for fetching account names.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch account names for a specific address
const accountNames = await aptos.getAccountNames({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify how many names to fetch
orderBy: "name", // specify the order by which to sort the names
},
});
console.log(accountNames);
}
runExample().catch(console.error);
+
+
+Fetches all subdomain names for a specified account.
+The arguments for retrieving subdomains.
+A promise of an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching subdomain names for a specific account
const subdomains = await aptos.getAccountSubdomains({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of subdomains to fetch
offset: 0, // specify the offset for pagination
orderBy: "name", // specify the order by which to sort the names
},
});
console.log(subdomains);
}
runExample().catch(console.error);
+
+
+Fetches all subdomain names for a given domain, excluding the domain itself.
+The arguments for fetching subdomains.
+A promise that resolves to an array of ANSName.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching subdomains for a specific domain
const subdomains = await aptos.getDomainSubdomains({
domain: "test", // replace with your domain
options: {
limit: 10, // specify the number of subdomains to fetch
offset: 0, // specify the starting point for fetching
orderBy: "name", // specify the order by which to sort the results
},
});
console.log(subdomains);
}
runExample().catch(console.error);
+
+
+Retrieve the expiration time of a domain name or subdomain name from the contract.
+The arguments for retrieving the expiration.
+A string of the name to retrieve.
+number as a unix timestamp in milliseconds.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the expiration time for the domain "test.aptos"
const exp = await aptos.getExpiration({ name: "test.aptos" });
// Log the expiration date
console.log(new Date(exp)); // Outputs the expiration date
}
runExample().catch(console.error);
+
+
+Fetches a single name from the indexer based on the provided name argument.
+The arguments for retrieving the name.
+A string of the name to retrieve, e.g. "test.aptos.apt" or "test.apt" or "test". +Can be inclusive or exclusive of the .apt suffix and can be a subdomain.
+A promise of an ANSName or undefined if the name is not active.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching a name from the indexer
const name = await aptos.getName({ name: "test.aptos" }); // replace with a real name
console.log(name);
}
runExample().catch(console.error);
+
+
+Retrieve the owner address of a specified domain name or subdomain name from the contract.
+The arguments for retrieving the owner address.
+A string representing the name of the domain or subdomain to retrieve the owner address for.
+AccountAddress if the name is owned, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the owner address of "test.aptos"
const owner = await aptos.getOwnerAddress({ name: "test.aptos" });
console.log(owner); // Logs the owner address or undefined if not owned
}
runExample().catch(console.error);
+
+
+Retrieve the primary name for an account. An account can have multiple names, but only one primary name, which may not exist.
+The arguments for retrieving the primary name.
+An AccountAddressInput (address) of the account.
+A string if the account has a primary name, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the primary name for the specified account address
const name = await aptos.getPrimaryName({ address: "0x1" }); // replace with a real account address
console.log(name);
}
runExample().catch(console.error);
+
+
+Retrieve the target address of a domain or subdomain name, which indicates the address the name points to for use on-chain. +Note that the target address can point to addresses that do not own the name.
+The arguments for retrieving the target address.
+A string representing the name, which can be a primary name, a subdomain, or a combination (e.g., +"primary", "primary.apt", "secondary.primary", "secondary.primary.apt").
+AccountAddress if the name has a target, undefined otherwise.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the target address for the specified domain name
const targetAddr = await aptos.getTargetAddress({ name: "test.aptos" });
console.log(targetAddr); // Logs the target address, e.g., 0x123...
}
runExample().catch(console.error);
+
+
+Registers a new name.
+This function allows you to register a domain or subdomain name with specific expiration policies and options.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Registering a subdomain name assuming def.apt is already registered and belongs to the sender alice.
const txn = await aptos.registerName({
sender: "0x1", // replace with a real sender account
name: "test.aptos.apt",
expiration: {
policy: "subdomain:independent",
expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000, // expires in 30 days
},
});
console.log("Transaction:", txn);
}
runExample().catch(console.error);
+
+
+Renews a domain name for one year. +If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.
+The arguments for renewing the domain.
+A string representing the domain to renew. Subdomains cannot be renewed.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction options.
+The sender account, which must be the domain owner.
+Optional
years?: 1The number of years to renew the name. Currently, only one year is permitted.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Renew the domain "test" for one year
const transaction = await aptos.renewDomain({
sender: Account.generate(), // replace with a real account
name: "test"
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Sets the primary name for the sender account, allowing them to designate a single primary name among potentially multiple +names. An account may not have a primary name.
+The arguments for setting the primary name.
+Optional
name?: stringA string representing the name to set as primary (e.g., "test.aptos").
+Optional
options?: InputGenerateTransactionOptionsOptional transaction options.
+The sender account.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the primary name for the sender account
const sender = Account.generate(); // replace with a real account
await aptos.setPrimaryName({ sender, name: "test.aptos" });
const primaryName = await aptos.getPrimaryName({ address: sender.accountAddress });
console.log("Primary Name:", primaryName); // Should log: "Primary Name: test.aptos"
}
runExample().catch(console.error);
+
+
+Sets the target address of a domain or subdomain name, pointing it to a specified address for use on-chain. +The target address can be different from the owner of the name.
+The arguments for setting the target address.
+The AccountAddressInput of the address to set the domain or subdomain to.
+A string representing the domain or subdomain name (e.g., "test.aptos").
+Optional
options?: InputGenerateTransactionOptionsOptional settings for generating the transaction.
+The account initiating the transaction.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Setting the target address for a domain name
const sender = Account.generate(); // replace with a real account
const address = "0x1"; // replace with a real account address
await aptos.setTargetAddress({
sender: sender,
name: "test.aptos",
address: address,
});
const targetAddress = await aptos.getTargetAddress({ name: "test.aptos" });
console.log(targetAddress); // Should log the address set for "test.aptos"
}
runExample().catch(console.error);
+
+
+A class to query all Account
related queries on Aptos.
Creates an instance of the Aptos client with the provided configuration.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Initialize the Aptos client with testnet configuration
const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Derives an account by providing a private key. This function resolves the provided private key type and derives the public +key from it.
+If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey +scheme locally. +If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519 +key or a Unified ED25519 key, and then derives the account based on that.
+The arguments for deriving the account.
+An account private key.
+The derived Account type.
+import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Deriving an account from a private key
const account = await aptos.deriveAccountFromPrivateKey({
privateKey: new Ed25519PrivateKey("0x123") // replace with a real private key
});
console.log(account);
}
runExample().catch(console.error);
+
+
+Retrieves the current amount of APT for a specified account.
+The arguments for the account query.
+The account address for which to retrieve the APT amount.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current amount of APT for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the APT amount for a specific account
const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: "0x1" }); // replace with a real account address
console.log("Account APT Amount:", accountAPTAmount);
}
runExample().catch(console.error);
+
+
+Queries the current amount of a specified coin held by an account.
+The parameters for querying the account's coin amount.
+The account address to query for the coin amount.
+Optional
coinThe coin type to query. Note: If not provided, it may be automatically populated if faMetadataAddress
+is specified.
Optional
faThe fungible asset metadata address to query. Note: If not provided, it may be automatically
+populated if coinType
is specified.
Optional
minimumNot used anymore, here for backward compatibility +see https://github.com/aptos-labs/aptos-ts-sdk/pull/519, will be removed in the near future. +Optional ledger version to sync up to before querying.
+The current amount of the specified coin held by the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Query the account's coin amount for a specific coin type
const accountCoinAmount = await aptos.getAccountCoinAmount({
accountAddress: "0x1", // replace with a real account address
coinType: "0x1::aptos_coin::AptosCoin" // specify the coin type
});
console.log(`Account coin amount: ${accountCoinAmount}`);
}
runExample().catch(console.error);
+
+
+Retrieves the current count of an account's coins aggregated across all types.
+The parameters for the account coins count query.
+The account address we want to get the total count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current count of the aggregated coins for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Getting the account coins count for a specific account
const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: "0x1" }); // replace with a real account address
console.log("Account Coins Count:", accountCoinsCount);
}
runExample().catch(console.error);
+
+
+Retrieves the coins data for a specified account.
+The account address for which to retrieve the coin's data.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ An array containing the coins data for the specified account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching coins data for a specific account
const accountCoinsData = await aptos.getAccountCoinsData({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify the number of results to return
orderBy: { asset_type: "asc" }, // specify the order of results
},
});
console.log(accountCoinsData);
}
runExample().catch(console.error);
+
+
+Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens. +If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.
+The account address we want to get the collections for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ Collections array with the collections data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get account collections with owned tokens for a specific account
const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({
accountAddress: "0x1", // replace with a real account address
options: {
tokenStandard: "NFT", // specify the token standard if needed
limit: 10, // specify the number of results to return
},
});
console.log(accountCollectionsWithOwnedTokens);
}
runExample().catch(console.error);
+
+
+Queries the current state for an Aptos account given its account address.
+The arguments for retrieving account information.
+The Aptos account address to query.
+The account data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve account information for a specific address
const accountInfo = await aptos.getAccountInfo({ accountAddress: "0x1" }); // replace with a real account address
console.log(accountInfo);
}
runExample().catch(console.error);
+
+
+Queries for a specific account module given an account address and module name.
+The Aptos account address.
+The name of the module.
+Optional
options?: LedgerVersionArgThe account module associated with the specified account address and module name.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the account module for a specific account address and module name
const module = await aptos.getAccountModule({
accountAddress: "0x1", // replace with a real account address
moduleName: "MyModule" // specify the module name
});
console.log(module);
}
runExample().catch(console.error);
+
+
+Queries for all modules in an account given an account address. +This function may call the API multiple times to auto paginate through results.
+The Aptos account address to query modules for.
+Optional
options?: PaginationArgs & LedgerVersionArgimport { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching account modules for a specific account
const accountModules = await aptos.getAccountModules({
accountAddress: "0x1", // replace with a real account address
options: {
offset: 0, // starting from the first module
limit: 10, // limiting to 10 modules
},
});
console.log(accountModules);
}
runExample().catch(console.error);
+
+
+Queries an account's owned objects.
+The account address we want to get the objects for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Objects array with the object data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the objects owned by the specified account
const accountOwnedObjects = await aptos.getAccountOwnedObjects({
accountAddress: "0x1", // replace with a real account address
minimumLedgerVersion: 1, // optional, specify if needed
options: {
offset: 0, // optional, specify if needed
limit: 10, // optional, specify if needed
orderBy: "created_at", // optional, specify if needed
},
});
console.log(accountOwnedObjects);
}
runExample().catch(console.error);
+
+
+Queries the tokens currently owned by a specified account, including NFTs and fungible tokens. +If desired, you can filter the results by a specific token standard.
+The account address for which to retrieve owned tokens.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ An array of tokens with their respective data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the tokens owned by a specific account
const accountOwnedTokens = await aptos.getAccountOwnedTokens({
accountAddress: "0x1", // replace with a real account address
options: {
limit: 10, // specify how many tokens to return
orderBy: "created_at", // specify the order of the results
},
});
console.log(accountOwnedTokens);
}
runExample().catch(console.error);
+
+
+Queries all current tokens of a specific collection that an account owns by the collection address. +This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc. +If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.
+The account address we want to get the tokens for.
+The address of the collection being queried.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ Tokens array with the token data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get tokens owned by a specific account in a specific collection
const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({
accountAddress: "0x1", // replace with a real account address
collectionAddress: "0x2", // replace with a real collection address
});
console.log(accountOwnedTokens);
}
runExample().catch(console.error);
+
+
+Queries a specific account resource given an account address and resource type.
+The Aptos account address to query.
+Optional
options?: LedgerVersionArgThe string representation of an on-chain Move struct type, e.g., "0x1::aptos_coin::AptosCoin".
+The account resource of the specified type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the account resource for a specific account address and resource type
const resource = await aptos.getAccountResource({
accountAddress: "0x1", // replace with a real account address
resourceType: "0x1::aptos_coin::AptosCoin"
});
console.log(resource);
}
runExample().catch(console.error);
+
+
+Queries all account resources given an account address. +This function may call the API multiple times to auto paginate through results.
+The Aptos account address to query resources for.
+Optional
options?: PaginationArgs & LedgerVersionArgAccount resources.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching account resources for a specific account address
const resources = await aptos.getAccountResources({ accountAddress: "0x1" }); // replace with a real account address
console.log(resources);
}
runExample().catch(console.error);
+
+
+Queries the current count of tokens owned by a specified account.
+The parameters for the query.
+The account address to query the token count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+The current count of tokens owned by the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the count of tokens owned by the account
const tokensCount = await aptos.getAccountTokensCount({ accountAddress: "0x1" }); // replace with a real account address
console.log(`Tokens Count: ${tokensCount}`);
}
runExample().catch(console.error);
+
+
+Queries account transactions given an account address. +This function may call the API multiple times to auto paginate and retrieve all account transactions.
+The Aptos account address to query transactions for.
+Optional
options?: PaginationArgsOptional pagination arguments.
+The account transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch transactions for a specific account
const transactions = await aptos.getAccountTransactions({
accountAddress: "0x1", // replace with a real account address
options: {
offset: 0, // starting from the first transaction
limit: 10, // limiting to 10 transactions
},
});
console.log(transactions);
}
runExample().catch(console.error);
+
+
+Queries the current count of transactions submitted by an account.
+The parameters for the query.
+The account address we want to get the total count for.
+Optional
minimumOptional ledger version to sync up to before querying.
+Current count of transactions made by an account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the count of transactions for a specific account
const accountTransactionsCount = await aptos.getAccountTransactionsCount({
accountAddress: "0x1", // replace with a real account address
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
});
console.log(accountTransactionsCount);
}
runExample().catch(console.error);
+
+
+Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.
+The authentication key for which to look up the account address.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: LedgerVersionArgPromise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Look up the original account address for a given authentication key
const accountAddress = await aptos.lookupOriginalAccountAddress({
authenticationKey: "0x1", // replace with a real authentication key
});
console.log("Original Account Address:", accountAddress);
}
runExample().catch(console.error);
+
+
+A class to query all Object
related queries on Aptos.
Creates an instance of the Aptos client with the provided configuration. +This allows interaction with the Aptos blockchain using the specified settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // Specify the desired network
nodeUrl: "https://testnet.aptos.dev", // Replace with your node URL
});
// Create an instance of the Aptos client
const aptos = new Aptos(config);
console.log("Aptos client created successfully", aptos);
}
runExample().catch(console.error);
+
+
+Fetches the object data based on the specified object address.
+Optional
minimumOptional minimum ledger version to wait for.
+The object address to retrieve data for.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional configuration options for pagination and ordering.
+The object data corresponding to the provided address.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching object data by object address
const objectData = await aptos.getObjectDataByObjectAddress({
objectAddress: "0x1", // replace with a real object address
});
console.log(objectData);
}
runExample().catch(console.error);
+
+
+Adds an item to the queue. If there are pending dequeued promises, it resolves the oldest promise with the enqueued item +immediately; otherwise, it adds the item to the queue.
+The item to be added to the queue.
+Represents an error that occurs when an asynchronous queue operation is cancelled. +This error extends the built-in Error class to provide additional context for cancellation events.
+Optional
message: stringA class to handle all Build
transaction operations.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // specify the network
nodeUrl: "https://testnet.aptos.dev", // specify the node URL
});
// Initialize the Aptos client
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Build a multi-agent transaction that allows multiple signers to authorize a transaction.
+The parameters for creating the multi-agent transaction.
+The transaction data.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction configurations.
+An array of the secondary signers' account addresses.
+The sender account address.
+Optional
withWhether there is a fee payer for the transaction.
+MultiAgentTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Build a multi-agent transaction
const transaction = await aptos.multiAgent({
sender: "0x1", // replace with a real sender account address
data: {
// Transaction data structure
function: "0x1::aptos_account::transfer",
functionArguments: ["0x2", 100], // replace with a real destination account address and amount
},
secondarySignerAddresses: ["0x3", "0x4"], // replace with real secondary signer addresses
options: {
// Optional transaction configurations
maxGasAmount: "1000",
gasUnitPrice: "1",
},
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Build a simple transaction.
+This function allows you to create a transaction with specified sender and data.
+The transaction data.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction configurations.
+The sender account address.
+Optional
withWhether there is a fee payer for the transaction.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Build a simple transaction
const transaction = await aptos.transaction.simple({
sender: "0x1", // replace with a real sender account address
data: {
function: "0x1::aptos_account::transfer",
functionArguments: ["0x2", 100], // replace with a real destination account address
},
options: {
gasUnitPrice: 100, // specify your own gas unit price if needed
maxGasAmount: 1000, // specify your own max gas amount if needed
},
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+A class to handle all Coin
operations.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client with testnet configuration
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Generate a transfer coin transaction that can be simulated, signed, and submitted. +This function helps you create a transaction to transfer a specified amount of coins +from one account to another within the Aptos network.
+The arguments for the transfer transaction.
+The amount of coins to transfer.
+Optional
coinOptional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The recipient account address.
+The sender account address.
+SimpleTransaction
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Generate a transfer coin transaction
const transaction = await aptos.transferCoinTransaction({
sender: "0x1", // replace with a real sender account address
recipient: "0x2", // replace with a real recipient account address
amount: 10,
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+A class to query all DigitalAsset
related queries on Aptos.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Add a digital asset property to the blockchain. +This function allows you to specify a new property for a digital asset, including its key, type, and value.
+The arguments for adding a digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digital(Optional) The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptions(Optional) Options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Add a digital asset property
const transaction = await aptos.addDigitalAssetPropertyTransaction({
creator: Account.generate(), // Replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Add a typed digital asset property to the blockchain. +This function allows you to define and store a specific property for a digital asset, enabling better categorization and +management of digital assets.
+The parameters for adding the typed property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digitalThe optional type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction generation options.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Adding a typed digital asset property
const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "typedKey",
propertyType: "STRING",
propertyValue: "hello",
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Burn a digital asset by its creator, allowing for the removal of a specified digital asset from the blockchain.
+The arguments for burning the digital asset.
+The creator account that is burning the digital asset.
+The address of the digital asset to be burned.
+Optional
digitalOptional. The type of the digital asset being burned.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const creator = Account.generate(); // Replace with a real creator account
const transaction = await aptos.burnDigitalAssetTransaction({
creator: creator,
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Creates a new collection within the specified account.
+A SimpleTransaction that when submitted will create the collection.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Creating a new collection transaction
const transaction = await aptos.createCollectionTransaction({
creator: Account.generate(), // Replace with a real account
description: "A unique collection of digital assets.",
name: "My Digital Collection",
uri: "https://mycollection.com",
});
console.log("Transaction created:", transaction);
}
runExample().catch(console.error);
+
+
+Freeze the ability to transfer a specified digital asset. +This function allows the creator to restrict the transfer capability of a digital asset.
+The arguments for freezing the digital asset transfer.
+The creator account initiating the freeze.
+The address of the digital asset to be frozen.
+Optional
digitalOptional. The type of the digital asset being frozen.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Freeze the digital asset transfer
const transaction = await aptos.freezeDigitalAssetTransaferTransaction({
creator: Account.generate(), // Replace with a real account if needed
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection creator address and the collection name.
+This function is deprecated; use getCollectionDataByCreatorAddressAndCollectionName
instead.
If a creator account has two collections with the same name in v1 and v2, you can pass an optional tokenStandard
parameter
+to query a specific standard.
The arguments for querying the collection data.
+The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArgOptional parameters for the query.
+GetCollectionDataResponse - The response type containing the collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Querying collection data by creator address and collection name
const collection = await aptos.getCollectionData({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection", // specify your collection name
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection ID.
+The ID of the collection, which is the same as the address of the collection object.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsOptional parameters for token standard and pagination.
+GetCollectionDataResponse - The response type containing the collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching collection data by collection ID
const collection = await aptos.getCollectionDataByCollectionId({
collectionId: "0x123", // replace with a real collection ID
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Retrieves data for a specific collection created by a given creator address. +This function allows you to query collection data while optionally specifying a minimum ledger version and pagination options.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse - The response type containing collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve collection data by creator address
const collectionData = await aptos.getCollectionDataByCreatorAddress({
creatorAddress: "0x1", // replace with a real creator address
minimumLedgerVersion: 1, // specify the minimum ledger version if needed
options: {
tokenStandard: "v2", // specify the token standard if needed
pagination: { limit: 10, offset: 0 } // specify pagination options if needed
}
});
console.log(collectionData);
}
runExample().catch(console.error);
+
+
+Queries data of a specific collection by the collection creator address and the collection name.
+If a creator account has multiple collections with the same name across different versions,
+specify the tokenStandard
parameter to query a specific standard.
The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse - The response type containing collection data.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching collection data by creator address and collection name
const collection = await aptos.getCollectionDataByCreatorAddressAndCollectionName({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection",
minimumLedgerVersion: 1, // optional, specify if needed
options: { tokenStandard: "v2" } // optional, specify if needed
});
console.log(collection);
}
runExample().catch(console.error);
+
+
+Queries the ID of a specified collection. +This ID corresponds to the collection's object address in V2, while V1 does not utilize objects and lacks an address.
+The name of the collection.
+The address of the collection's creator.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: TokenStandardArgThe collection ID.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the collection ID for a specific creator and collection name
const collectionId = await aptos.getCollectionId({
creatorAddress: "0x1", // replace with a real creator address
collectionName: "myCollection"
});
console.log("Collection ID:", collectionId);
}
runExample().catch(console.error);
+
+
+Retrieves the current ownership data of a specified digital asset using its address.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Getting the current ownership of a digital asset
const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAssetOwner);
}
runExample().catch(console.error);
+
+
+Retrieves the activity data for a specified digital asset using its address.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional minimum ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters.
+A promise that resolves to the activity data related to the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the activity data for a digital asset
const digitalAssetActivity = await aptos.getDigitalAssetActivity({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAssetActivity);
}
runExample().catch(console.error);
+
+
+Retrieves digital asset data using the address of a digital asset.
+The parameters for the request.
+The address of the digital asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+GetTokenDataResponse containing relevant data for the digital asset.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching digital asset data for a specific address
const digitalAsset = await aptos.getDigitalAssetData({
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(digitalAsset);
}
runExample().catch(console.error);
+
+
+Retrieves the digital assets owned by a specified address.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the response.
+The address of the owner.
+GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddress.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the digital assets owned by the specified address
const digitalAssets = await aptos.getOwnedDigitalAssets({
ownerAddress: "0x1", // replace with a real account address
});
console.log(digitalAssets);
}
runExample().catch(console.error);
+
+
+Create a transaction to mint a digital asset into the creator's account within an existing collection. +This function helps you generate a transaction that can be simulated or submitted to the blockchain for minting a digital asset.
+The name of the collection the digital asset belongs to.
+The creator of the collection.
+The description of the digital asset.
+The name of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional transaction generation options.
+Optional
propertyOptional array of property keys for the digital asset.
+Optional
propertyOptional array of property types for the digital asset.
+Optional
propertyOptional array of property values for the digital asset.
+The URI to additional info about the digital asset.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Creating a transaction to mint a digital asset
const transaction = await aptos.mintDigitalAssetTransaction({
creator: Account.generate(), // replace with a real account
collection: "MyCollection",
description: "This is a digital asset.",
name: "MyDigitalAsset",
uri: "https://example.com/my-digital-asset",
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Mint a soul bound digital asset into a recipient's account. +This function allows you to create a unique digital asset that is bound to a specific account.
+The arguments for minting the soul bound transaction.
+The account that mints the digital asset.
+The collection name that the digital asset belongs to.
+The digital asset description.
+The digital asset name.
+Optional
options?: InputGenerateTransactionOptionsAdditional options for generating the transaction.
+Optional
propertyThe property keys for storing on-chain properties.
+Optional
propertyThe type of property values.
+Optional
propertyThe property values to be stored on-chain.
+The account address where the digital asset will be created.
+The digital asset URL.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Mint a soul bound digital asset
const transaction = await aptos.mintSoulBoundTransaction({
account: Account.generate(), // Replace with a real account
collection: "collectionName",
description: "collectionDescription",
name: "digitalAssetName",
uri: "digital-asset-uri.com",
recipient: "0x123" // Replace with a real recipient account address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Remove a digital asset property from the blockchain. +This function allows you to delete an existing property associated with a digital asset.
+The parameters required to remove the digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Remove a digital asset property
const transaction = await aptos.removeDigitalAssetPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Set the digital asset description to provide additional context or information about the asset.
+The parameters for setting the digital asset description.
+The creator account responsible for the digital asset.
+The digital asset description to be set.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the digital asset description
const transaction = await aptos.setDigitalAssetDescriptionTransaction({
creator: Account.generate(), // replace with a real account
description: "This is a digital asset description.",
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Set the digital asset name, allowing you to define a name for a specific digital asset on the blockchain.
+The parameters for setting the digital asset name.
+The creator account responsible for the transaction.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset, represented as a Move struct ID.
+The desired name for the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the blockchain.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const creator = Account.generate(); // Generate a new account for the creator
const digitalAssetAddress = "0x123"; // replace with a real digital asset address
// Set the digital asset name
const transaction = await aptos.setDigitalAssetNameTransaction({
creator: creator,
name: "digitalAssetName",
digitalAssetAddress: digitalAssetAddress,
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Set the URI for a digital asset, allowing you to associate a unique identifier with the asset.
+The parameters for the transaction.
+The creator account initiating the transaction.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The digital asset URI to be set.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Set the URI for a digital asset
const transaction = await aptos.setDigitalAssetURITransaction({
creator: Account.generate(), // Replace with a real creator account
uri: "digital-asset-uri.com",
digitalAssetAddress: "0x123", // Replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Transfer ownership of a non-fungible digital asset. +This function allows you to transfer a digital asset only if it is not frozen, meaning the ownership transfer is not disabled.
+The arguments for transferring the digital asset.
+The address of the digital asset being transferred.
+Optional
digitalOptional. The type of the digital asset, defaults to "0x4::token::Token".
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The account address of the recipient.
+The sender account of the current digital asset owner.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Transfer a digital asset
const transaction = await aptos.transferDigitalAssetTransaction({
sender: Account.generate(), // replace with a real sender account
digitalAssetAddress: "0x123", // replace with a real digital asset address
recipient: "0x456", // replace with a real recipient account address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Unfreeze the ability to transfer a digital asset. +This function allows the specified creator account to unfreeze the transfer of a digital asset identified by its address.
+The parameters for unfreezing the digital asset transfer.
+The creator account that is unfreezing the digital asset transfer.
+The address of the digital asset to unfreeze.
+Optional
digitalOptional. The type of the digital asset being unfrozen.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Unfreeze the ability to transfer a digital asset
const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({
creator: Account.generate(), // replace with a real creator account
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Update a digital asset property on-chain.
+The parameters for updating the digital asset property.
+The account that mints the digital asset.
+The address of the digital asset.
+Optional
digitalOptional. The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptionsOptional. Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Update a digital asset property
const transaction = await aptos.updateDigitalAssetPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: false,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Update a typed digital asset property on-chain. +This function allows you to modify the properties of a digital asset, enabling dynamic updates to its attributes.
+The arguments for updating the digital asset property.
+The account that mints the digital asset.
+The digital asset address.
+Optional
digital(Optional) The type of the digital asset.
+Optional
options?: InputGenerateTransactionOptions(Optional) Additional options for generating the transaction.
+The property key for storing on-chain properties.
+The type of property value.
+The property value to be stored on-chain.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Update a typed digital asset property
const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({
creator: Account.generate(), // replace with a real account
propertyKey: "typedKey",
propertyType: "U8",
propertyValue: 2,
digitalAssetAddress: "0x123", // replace with a real digital asset address
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+A class to query all Event
Aptos related queries.
Initializes a new instance of the Aptos client with the provided configuration.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client with Testnet configuration
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Retrieve events associated with a specific account address and creation number.
+The parameters for retrieving account events.
+The account address to query events for.
+The event creation number to filter the events.
+Optional
minimumOptional minimum ledger version to sync up to before querying.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get events for the account at creation number 0
const events = await aptos.getAccountEventsByCreationNumber({
accountAddress: "0x1", // replace with a real account address
creationNumber: 0,
});
console.log(events);
}
runExample().catch(console.error);
+
+
+Retrieve events associated with a specific account address and event type.
+The account address to query events for.
+The type of event to filter by.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the event query.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get events for a specific account and event type
const events = await aptos.getAccountEventsByEventType({
accountAddress: "0x1", // replace with a real account address
eventType: "0x1::transaction_fee::FeeStatement", // replace with a real event type
minimumLedgerVersion: 1, // optional, specify if needed
});
console.log(events);
}
runExample().catch(console.error);
+
+
+Retrieve all events from the Aptos blockchain.
+An optional where
clause can be provided to filter the results based on specific criteria.
Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and filtering options.
+GetEventsQuery response type containing the events.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve all events
const events = await aptos.getEvents();
// Retrieve events with filtering by account address
const whereCondition = {
account_address: { _eq: "0x123" }, // replace with a real account address
};
const filteredEvents = await aptos.getEvents({
options: { where: whereCondition },
});
console.log(events);
console.log(filteredEvents);
}
runExample().catch(console.error);
+
+
+Retrieve module events based on a specified event type. +This function allows you to query for events that are associated with a particular module event type in the Aptos blockchain.
+The arguments for retrieving module events.
+The event type to filter the results.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & OrderByArg<{ Optional pagination and ordering parameters for the event results.
+Promise
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve module events for a specific event type
const events = await aptos.getModuleEventsByEventType({
eventType: "0x1::transaction_fee::FeeStatement", // specify the event type
minimumLedgerVersion: 1, // optional: specify minimum ledger version if needed
});
console.log(events); // log the retrieved events
}
runExample().catch(console.error);
+
+
+Minimal EventEmitter
interface that is molded against the Node.js
+EventEmitter
interface.
Optional
context: ContextCalls each of the listeners registered for a given event.
+Rest
...args: Parameters<EventListener<EventTypes, T>>Return an array listing the events for which the emitter has registered +listeners.
+Return the number of listeners listening to a given event.
+Return the listeners registered for a given event.
+Optional
fn: EventListener<EventTypes, T>Optional
context: ContextOptional
once: booleanAdd a listener for a given event.
+Optional
context: ContextAdd a one-time listener for a given event.
+Optional
context: ContextRemove all listeners, or those of the specified event.
+Optional
event: EventNames<EventTypes>Remove the listeners of a given event.
+Optional
fn: EventListener<EventTypes, T>Optional
context: ContextOptional
once: booleanA class to query all Faucet
related queries on Aptos.
Initializes a new instance of the Aptos client with the specified configuration.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+This function creates an account if it does not exist and mints the specified amount of coins into that account.
+The arguments for funding the account.
+The address of the account to fund.
+The amount of tokens to fund the account with.
+Optional
options?: WaitForTransactionOptionsConfiguration options for waiting for the transaction.
+Transaction hash of the transaction that funded the account.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fund an account with a specified amount of tokens
const transaction = await aptos.fundAccount({
accountAddress: "0x1", // replace with your account address
amount: 100,
});
console.log("Transaction hash:", transaction.hash);
}
runExample().catch(console.error);
+
+
+A class for querying and managing fungible asset-related operations on the Aptos blockchain.
+Initializes a new instance of the Aptos class with the provided configuration. +This allows you to interact with the Aptos blockchain using the specified network settings.
+The configuration settings for connecting to the Aptos network.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Queries all fungible asset balances.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching current fungible asset balances
const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances();
console.log(fungibleAssetBalances);
}
runExample().catch(console.error);
+
+
+Queries all fungible asset activities and returns a list of their metadata.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to, before querying.
+Optional
options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching fungible asset activities
const fungibleAssetActivities = await aptos.getFungibleAssetActivities();
console.log(fungibleAssetActivities);
}
runExample().catch(console.error);
+
+
+Queries all fungible asset metadata.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>Optional configuration for pagination and filtering.
+A list of fungible asset metadata.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching fungible asset metadata
const fungibleAssets = await aptos.getFungibleAssetMetadata();
console.log(fungibleAssets);
}
runExample().catch(console.error);
+
+
+Queries the fungible asset metadata for a specific asset type. +This function helps retrieve detailed information about a fungible asset based on its type.
+A fungible asset metadata item.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve fungible asset metadata by asset type
const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({
assetType: "0x1::aptos_coin::AptosCoin" // replace with your asset type
});
console.log(fungibleAsset);
}
runExample().catch(console.error);
+
+
+Retrieves fungible asset metadata based on the creator address.
+This function allows you to query metadata for a specific fungible asset created by a given address.
+The parameters for the query.
+The creator address of the fungible asset.
+Optional
minimumOptional ledger version to sync up to before querying.
+A fungible asset metadata item.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve fungible asset metadata by creator address
const fungibleAsset = await aptos.getFungibleAssetMetadataByCreatorAddress({
creatorAddress: "0x123", // replace with a real creator address
});
console.log(fungibleAsset);
}
runExample().catch(console.error);
+
+
+Transfer a specified amount of fungible asset from the sender's primary store to the recipient's primary store. +This method allows you to transfer any fungible asset, including fungible tokens.
+The arguments for the transfer operation.
+The number of assets to transfer.
+The fungible asset account address. For example, if you’re transferring USDT, +this would be the USDT address.
+Optional
options?: InputGenerateTransactionOptionsOptional parameters for generating the transaction.
+The recipient account address.
+The sender account.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Transfer fungible asset from sender to recipient
const transaction = await aptos.transferFungibleAsset({
sender: Account.generate(), // replace with a real sender account
fungibleAssetMetadataAddress: "0x123", // replace with a real fungible asset address
recipient: "0x456", // replace with a real recipient account
amount: 5
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Represents a fixed-size byte array of 32 bytes, extending the Serializable class. +This class is used for handling and serializing G1 bytes in cryptographic operations.
+Static
deserializeRepresents a 64-byte G2 element in a cryptographic context. +This class provides methods for serialization and deserialization of G2 bytes.
+Static
deserializeA class to query various Aptos-related information and perform operations on the Aptos blockchain.
+Initializes a new instance of the Aptos client with the specified configuration. +This allows users to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // specify the network
nodeUrl: "https://testnet.aptos.dev" // specify the node URL
});
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Retrieve a block by its height, allowing for the inclusion of transactions if specified.
+The parameters for the block retrieval.
+The block height to look up, starting at 0.
+Optional
options?: { Optional settings for the retrieval.
+Optional
withThe block with optional transactions included.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the block at height 5, including transactions
const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } });
console.log(block);
}
runExample().catch(console.error);
+
+
+Retrieves block information by the specified ledger version.
+The arguments for retrieving the block.
+The ledger version to lookup block information for.
+Optional
options?: { Optional parameters for the request.
+Optional
withBlock information with optional transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve block information for a specific ledger version
const block = await aptos.getBlockByVersion({ ledgerVersion: 5 });
console.log(block);
}
runExample().catch(console.error);
+
+
+Retrieves the chain ID of the Aptos blockchain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the chain ID
const chainId = await aptos.getChainId();
console.log("Chain ID:", chainId);
}
runExample().catch(console.error);
@returns The chain ID of the Aptos blockchain.
+
+
+Queries the top user transactions based on the specified limit.
+The arguments for querying top user transactions.
+The number of transactions to return.
+GetChainTopUserTransactionsResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch the top user transactions with a limit of 5
const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 });
console.log(topUserTransactions);
}
runExample().catch(console.error);
+
+
+Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which +may lag behind the full nodes.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the last successful indexer version
const version = await aptos.getIndexerLastSuccessVersion();
console.log(`Last successful indexer version: ${version}`);
}
runExample().catch(console.error);
+
+
+Queries for the Aptos ledger information.
+The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching the ledger information
const ledgerInfo = await aptos.getLedgerInfo();
console.log(ledgerInfo);
}
runExample().catch(console.error);
+
+
+Query the processor status for a specific processor type.
+The processor type to query.
+The status of the specified processor type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the processor status for the account transactions processor
const status = await aptos.getProcessorStatus("account_transactions_processor");
console.log(status);
}
runExample().catch(console.error);
+
+
+Retrieves data from the Aptos Indexer using a GraphQL query. +This function allows you to execute complex queries to fetch specific data from the Aptos blockchain.
+The provided T type.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Querying the Aptos Indexer for ledger information
const topUserTransactions = await aptos.queryIndexer({
query: `query MyQuery {
ledger_infos {
chain_id
}
}`
});
console.log(topUserTransactions);
}
runExample().catch(console.error);
+
+
+Queries for a Move view function
+Optional
options?: LedgerVersionArgPayload for the view function
+an array of Move values
+Queries for a Move view function with JSON, this provides compatability with the old aptos
package
Optional
options?: LedgerVersionArgPayload for the view function
+an array of Move values
+A class to query all Keyless
related queries on Aptos.
More documentation on how to integrate Keyless Accounts see the below +Aptos Keyless Integration Guide.
+Initializes a new instance of the Aptos class with the provided configuration. +This allows you to interact with the Aptos blockchain using the specified network settings.
+The configuration settings for connecting to the Aptos network.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Optional
pepper?: HexInputOptional
proofOptional
uidOptional
pepper?: HexInputOptional
proofOptional
uidFetches the pepper from the Aptos pepper service API.
+The arguments for fetching the pepper.
+Optional
derivationA derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults +to "m/44'/637'/0'/0'/0".
+The EphemeralKeyPair used to generate the nonce in the JWT token.
+JWT token.
+The pepper which is a Uint8Array of length 31.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair
const jwt = "your_jwt_token"; // replace with a real JWT token
// Fetching the pepper using the provided JWT and ephemeral key pair
const pepper = await aptos.getPepper({
jwt,
ephemeralKeyPair,
// derivationPath: "m/44'/637'/0'/0'/0" // specify your own if needed
});
console.log("Fetched pepper:", pepper);
}
runExample().catch(console.error);
+
+
+Fetches a proof from the Aptos prover service API.
+The arguments for fetching the proof.
+The EphemeralKeyPair used to generate the nonce in the JWT token.
+JWT token.
+Optional
pepper?: HexInputThe pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.
+Optional
uidA key in the JWT token to use to set the uidVal in the IdCommitment.
+The proof which is represented by a ZeroKnowledgeSig.
+import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const jwt = "your_jwt_token"; // replace with a real JWT token
const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair
// Fetch the proof using the getProof function
const proof = await aptos.getProof({
jwt,
ephemeralKeyPair,
pepper: await getPepper({}), // fetch the pepper if not provided
uidKey: "sub", // specify the uid key
});
console.log("Fetched proof:", proof);
}
runExample().catch(console.error);
+
+
+This installs a set of FederatedJWKs at an address for a given iss.
+It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address +to reflect it.
+the iss claim of the federated OIDC provider.
+Optional
jwksthe URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.
+Optional
options?: InputGenerateTransactionOptionsThe account that will install the JWKs
+The pending transaction that results from submission.
+Abstract
An abstract representation of a cryptographic proof associated with specific +zero-knowledge proof schemes, such as Groth16 and PLONK.
+Abstract
serializeA class to handle all Simulate
transaction operations.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Simulates a multi-agent transaction by generating a signed transaction and posting it to the Aptos full node. +This function helps in understanding the outcome of a transaction involving multiple signers before it is executed.
+The parameters for simulating the transaction.
+Optional
fee(Optional) The public key of the fee payer.
+Optional
options?: InputSimulateTransactionOptions(Optional) Options for simulating the transaction.
+An array of public keys for secondary signers.
+The public key of the primary signer.
+The raw transaction to be simulated.
+import {
Account,
Aptos,
AptosConfig,
Network,
} from "@aptos-labs/ts-sdk";
async function example() {
let sender1 = Account.generate();
let sender2 = Account.generate();
let receiver = Account.generate();
// 0. Set up the client and test accounts
const config = new AptosConfig({ network: Network.DEVNET });
const aptos = new Aptos(config);
await aptos.fundAccount({
accountAddress: sender.accountAddress,
amount: 100_000_000,
});
// 1. Build
console.log("\n=== 1. Building the transaction ===\n");
const transaction = await aptos.transaction.build.multiAgent({
sender: sender1.accountAddress,
secondarySignerAddresses: [sender2.accountAddress],
data: {
// REPLACE WITH YOUR MULTI-AGENT FUNCTION HERE
function:
"<REPLACE WITH YOUR MULTI AGENT MOVE ENTRY FUNCTION> (Syntax {address}::{module}::{function})",
functionArguments: [],
},
});
console.log("Transaction:", transaction);
// 2. Simulate (Optional)
console.log("\n === 2. Simulating Response (Optional) === \n");
const [userTransactionResponse] = await aptos.transaction.simulate.multiAgent(
{
signerPublicKey: sender1.publicKey,
secondarySignersPublicKeys: [sender2.publicKey],
transaction,
},
);
console.log(userTransactionResponse);
// If the fee looks ok, continue to signing!
// ...
}
example();
+
+
+Simulates a transaction based on the provided parameters and returns the result. +This function helps you understand the outcome of a transaction before executing it on the blockchain.
+The parameters for simulating the transaction.
+Optional
feeThe public key of the fee payer (optional).
+Optional
options?: InputSimulateTransactionOptionsAdditional options for simulating the transaction (optional).
+The public key of the signer for the transaction.
+The raw transaction data to simulate.
+import {
Account,
Aptos,
AptosConfig,
Network,
} from "@aptos-labs/ts-sdk";
async function example() {
let sender = Account.generate();
let receiver = Account.generate();
// 0. Set up the client and test accounts
const config = new AptosConfig({ network: Network.DEVNET });
const aptos = new Aptos(config);
await aptos.fundAccount({
accountAddress: sender.accountAddress,
amount: 100_000_000,
});
// 1. Build the transaction to preview the impact of it
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
// All transactions on Aptos are implemented via smart contracts.
function: "0x1::aptos_account::transfer",
functionArguments: [receiver.accountAddress, 100],
},
});
// 2. Simulate to see what would happen if we execute this transaction
const [userTransactionResponse] = await aptos.transaction.simulate.simple({
signerPublicKey: sender.publicKey,
transaction,
});
console.log(userTransactionResponse);
// If the fee looks ok, continue to signing!
// ...
}
example();
+
+
+A class to query all Staking
related queries on Aptos.
Creates an instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Queries delegated staking activities for a specific delegator and pool.
+The arguments for querying delegated staking activities.
+The address of the delegator.
+Optional
minimumOptional ledger version to sync up to before querying.
+The address of the staking pool.
+The response containing delegated staking activities.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get delegated staking activities for a specific delegator and pool
const activities = await aptos.getDelegatedStakingActivities({
delegatorAddress: "0x1", // replace with a real delegator address
poolAddress: "0x2", // replace with a real pool address
minimumLedgerVersion: 1, // specify your own if needed
});
console.log(activities);
}
runExample().catch(console.error);
+
+
+Queries the current number of delegators in a specified pool. Throws an error if the pool is not found.
+The parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+The address of the pool to query.
+The number of delegators for the given pool.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Get the number of delegators for a specific pool
const delegators = await aptos.getNumberOfDelegators({ poolAddress: "0x1" }); // replace with a real pool address
console.log(`Number of delegators: ${delegators}`);
}
runExample().catch(console.error);
+
+
+Retrieves the current number of delegators across all pools.
+Optional
args: { Optional parameters for the query.
+Optional
minimumOptional ledger version to sync up to before querying.
+Optional
options?: OrderByArg<{ Optional ordering options for the response.
+GetNumberOfDelegatorsForAllPoolsResponse response type containing the number of delegators per pool.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve the number of delegators for all pools
const delegators = await aptos.getNumberOfDelegatorsForAllPools();
console.log(delegators);
}
runExample().catch(console.error);
+
+
+A class to handle all Submit
transaction operations.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // Use the TESTNET for testing
nodeUrl: "https://testnet.aptos.dev", // Specify the node URL
faucetUrl: "https://faucet.testnet.aptos.dev" // Specify the faucet URL
});
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Submits a multi-agent transaction to the Aptos network, allowing multiple signers to authorize the transaction. +This function is useful for scenarios where a transaction requires approval from multiple accounts.
+The parameters for the multi-agent transaction.
+An array of authenticators for additional signers.
+Optional
feeAn optional authenticator for the fee payer account.
+The authenticator for the sender account.
+The raw transaction to be submitted.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new sender account
const additionalSigner1 = Account.generate(); // Generate an additional signer account
const additionalSigner2 = Account.generate(); // Generate another additional signer account
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [additionalSigner1.accountAddress, 100],
},
});
const response = await aptos.multiAgent({
transaction,
senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator
additionalSignersAuthenticators: [
additionalSigner1.getAuthenticator(), // Use the first additional signer's authenticator
additionalSigner2.getAuthenticator(), // Use the second additional signer's authenticator
],
});
console.log(response); // Log the response from the transaction submission
}
runExample().catch(console.error);
+
+
+Submits a transaction to the Aptos blockchain using the provided transaction details and authenticators. +This function allows you to execute transactions securely by specifying the sender and optional fee payer authenticators.
+The arguments for submitting the transaction.
+Optional
feeThe optional authenticator for the fee payer's account.
+The authenticator for the sender's account.
+The raw transaction data to be submitted.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new sender account
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [Account.generate().accountAddress, 100], // Replace with a real destination account
},
});
// Submit the transaction
const response = await aptos.simple({
transaction,
senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator
});
console.log("Transaction submitted:", response);
}
runExample().catch(console.error);
+
+
+A class to query all Table
Aptos related queries.
Initializes a new instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client with testnet configuration
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
console.log("Aptos client initialized:", aptos);
}
runExample().catch(console.error);
+
+
+Queries for a specific item in a table identified by the handle and the key for the item. +This function allows you to retrieve structured data from a table in the Aptos blockchain.
+Object that describes the table item, including key and value types.
+A pointer to where that table is stored.
+Optional
options?: LedgerVersionArgTable item value rendered in JSON.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve a table item from the Aptos blockchain
const tableItem = await aptos.getTableItem({
handle: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca",
data: {
key_type: "address", // Move type of table key
value_type: "u128", // Move type of table value
key: "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key
},
});
console.log(tableItem);
}
runExample().catch(console.error);
+
+
+Queries for table items data with optional filtering and pagination. +This function allows you to retrieve specific data from a table based on provided criteria.
+The arguments for querying table items data.
+Optional
minimumOptional minimum ledger version to wait for before querying.
+Optional
options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<{ Optional parameters for pagination and filtering.
+GetTableItemsDataResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Retrieve table items data with specific filtering options
const data = await aptos.getTableItemsData({
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
options: {
where: {
table_handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" },
transaction_version: { _eq: "0" }
},
limit: 10, // specify your own limit if needed
},
});
console.log(data);
}
runExample().catch(console.error);
+
+
+Queries for the metadata of table items, allowing for filtering and pagination.
+The parameters for the query.
+Optional
minimumOptional minimum ledger version to wait for before querying.
+Optional
options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<{ Optional parameters for pagination and filtering.
+GetTableItemsMetadataResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching table items metadata with a filter condition
const data = await aptos.getTableItemsMetadata({
minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
options: {
where: { handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" } },
limit: 10, // specify your own limit if needed
},
});
console.log(data);
}
runExample().catch(console.error);
+
+
+Represents a transaction in the Aptos blockchain, +providing methods to build, simulate, submit, and manage transactions. +This class encapsulates functionalities for querying transaction details, +estimating gas prices, signing transactions, and handling transaction states.
+This class is used as part of the Aptos object, so should be called like so:
+import { Account, Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const APTOS_COIN = "0x1::aptos_coin::AptosCoin";
const COIN_STORE = `0x1::coin::CoinStore<${APTOS_COIN}>`;
const ALICE_INITIAL_BALANCE = 100_000_000;
const TRANSFER_AMOUNT = 100;
async function example() {
console.log(
"This example will create two accounts (Alice and Bob), fund them, and transfer between them.",
);
// Set up the client
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
// Generate two account credentials
// Each account has a private key, a public key, and an address
const alice = Account.generate();
const bob = Account.generate();
console.log("=== Addresses ===\n");
console.log(`Alice's address is: ${alice.accountAddress}`);
console.log(`Bob's address is: ${bob.accountAddress}`);
// Fund the accounts using a faucet
console.log("\n=== Funding accounts ===\n");
await aptos.fundAccount({
accountAddress: alice.accountAddress,
amount: ALICE_INITIAL_BALANCE,
});
// Send a transaction from Alice's account to Bob's account
const txn = await aptos.transaction.build.simple({
sender: alice.accountAddress,
data: {
// All transactions on Aptos are implemented via smart contracts.
function: "0x1::aptos_account::transfer",
functionArguments: [bob.accountAddress, 100],
},
});
console.log("\n=== Transfer transaction ===\n");
// Both signs and submits
const committedTxn = await aptos.signAndSubmitTransaction({
signer: alice,
transaction: txn,
});
// Waits for Aptos to verify and execute the transaction
const executedTransaction = await aptos.waitForTransaction({
transactionHash: committedTxn.hash,
});
console.log("Transaction hash:", executedTransaction.hash);
console.log("\n=== Balances after transfer ===\n");
const newAliceAccountBalance = await aptos.getAccountResource({
accountAddress: alice.accountAddress,
resourceType: COIN_STORE,
});
const newAliceBalance = Number(newAliceAccountBalance.coin.value);
console.log(`Alice's balance is: ${newAliceBalance}`);
const newBobAccountBalance = await aptos.getAccountResource({
accountAddress: bob.accountAddress,
resourceType: COIN_STORE,
});
const newBobBalance = Number(newBobAccountBalance.coin.value);
console.log(`Bob's balance is: ${newBobBalance}`);
}
example();
+
+
+Creates an instance of the Aptos client with the specified configuration. +This allows you to interact with the Aptos blockchain using the provided settings.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a new Aptos client instance
const config = new AptosConfig({ network: Network.TESTNET }); // Specify the network
const aptos = new Aptos(config);
console.log("Aptos client created successfully:", aptos);
}
runExample().catch(console.error);
+
+
+The arguments for batching transactions.
+An array of transaction payloads to be processed.
+Optional
options?: Omit<InputGenerateTransactionOptions, "accountSequenceNumber">Optional. Transaction generation configurations (excluding accountSequenceNumber).
+The sender account to sign and submit the transactions.
+Prefer to use aptos.transaction.batch.forSingleAccount()
Batch transactions for a single account by submitting multiple transaction payloads. +This function is useful for efficiently processing and submitting transactions that do not depend on each other, such as +batch funding or batch token minting.
+import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
const sender = Account.generate(); // Generate a new account for sending transactions
async function runExample() {
const transactions = [
{ }, // Build your first transaction payload
{ }, // Build your second transaction payload
];
// Batch transactions for the single account
await aptos.batchTransactionsForSingleAccount({
sender,
data: transactions,
});
console.log("Batch transactions submitted successfully.");
}
runExample().catch(console.error);
+
+
+Estimates the gas unit price required to process a transaction on the Aptos blockchain in a timely manner. +This helps users to understand the cost associated with their transactions. +https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price
+An object containing the estimated gas price.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network
const aptos = new Aptos(config);
async function runExample() {
// Getting the gas price estimation
const gasPriceEstimation = await aptos.getGasPriceEstimation();
console.log("Estimated Gas Price:", gasPriceEstimation);
}
runExample().catch(console.error);
+
+
+Returns a signing message for a transaction, allowing a user to sign it using their preferred method before submission to the network.
+The arguments for obtaining the signing message.
+A raw transaction for signing elsewhere.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const transaction = await aptos.transaction.build.simple({
sender: "0x1", // replace with a real sender address
data: {
function: "0x1::aptos_account::transfer",
functionArguments: ["0x2", 100], // replace with a real destination address
},
});
const message = await aptos.getSigningMessage({ transaction });
console.log(message);
}
runExample().catch(console.error);
+
+
+Queries on-chain transactions by their transaction hash, returning both pending and committed transactions.
+The transaction from the mempool (pending) or the on-chain (committed) transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch a transaction by its hash
const transaction = await aptos.getTransactionByHash({ transactionHash: "0x123" }); // replace with a real transaction hash
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Queries on-chain transaction by version. This function will not return pending transactions.
+On-chain transaction. Only on-chain transactions have versions, so this +function cannot be used to query pending transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetching a transaction by its version
const transaction = await aptos.getTransactionByVersion({ ledgerVersion: 1 }); // replace 1 with a real version
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Queries on-chain transactions, excluding pending transactions. +Use this function to retrieve historical transactions from the blockchain.
+Optional
args: { Optional parameters for pagination.
+Optional
options?: PaginationArgsOptional pagination options.
+An array of on-chain transactions.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Fetch transactions with pagination
const transactions = await aptos.getTransactions({
options: {
offset: 0, // Start from the first transaction
limit: 10, // Limit to 10 results
},
});
console.log(transactions);
}
runExample().catch(console.error);
+
+
+Defines if the specified transaction is currently in a pending state. +This function helps you determine the status of a transaction using its hash.
+true
if the transaction is in a pending state and false
otherwise.
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Check if the transaction is pending using its hash
const isPendingTransaction = await aptos.isPendingTransaction({ transactionHash: "0x123" }); // replace with a real transaction hash
console.log("Is the transaction pending?", isPendingTransaction);
}
runExample().catch(console.error);
+
+
+Generates a transaction to publish a Move package to the blockchain. +This function helps you create a transaction that can be simulated or submitted to the chain for publishing a package.
+To get the metadataBytes
and byteCode
, can compile using Aptos CLI with command
+aptos move compile --save-metadata ...
,
https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module
+The arguments for publishing the package.
+The publisher account.
+The package metadata bytes.
+An array of the bytecode of each module in the package in compiler output order.
+Optional
options?: InputGenerateTransactionOptionsOptional settings for generating the transaction.
+A SimpleTransaction that can be simulated or submitted to the chain.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Replace with a real account address
const account = "0x1";
const metadataBytes = "0x..."; // replace with real metadata bytes
const byteCode = "0x..."; // replace with real module bytecode
const transaction = await aptos.publishPackageTransaction({
account,
metadataBytes,
moduleBytecode: [byteCode],
});
console.log(transaction);
}
runExample().catch(console.error);
+
+
+Rotate an account's authentication key. After rotation, only the new private key can be used to sign transactions for the account. +Note: Only legacy Ed25519 scheme is supported for now. +More info: https://aptos.dev/guides/account-management/key-rotation/
+The arguments for rotating the auth key.
+The account to rotate the auth key for.
+The new private key to rotate to.
+PendingTransactionResponse
+import { Aptos, AptosConfig, Network, Account, PrivateKey } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Rotate the authentication key for an account
const response = await aptos.rotateAuthKey({
// replace with a real account
fromAccount: Account.generate(),
// replace with a real private key
toNewPrivateKey: new PrivateKey("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"),
});
console.log(response);
}
runExample().catch(console.error);
+
+
+Sign a transaction that can later be submitted to the chain. +This function is essential for ensuring the authenticity of the transaction by using the provided account's signing capabilities.
+The arguments for signing the transaction.
+The account that will sign the transaction.
+A raw transaction to sign.
+AccountAuthenticator - The authenticator for the signed transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for signing
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [ "0x1", 100 ], // replace with a real account address and amount
},
});
const signedTransaction = await aptos.transaction.sign({
signer: sender,
transaction,
}); // Sign the transaction
console.log("Signed Transaction:", signedTransaction);
}
runExample().catch(console.error);
+
+
+Sign and submit a single signer transaction as the fee payer to chain given an authenticator by the sender of the transaction.
+The fee payer account to sign the transaction
+The AccountAuthenticator signed by the sender of the transaction
+An instance of a RawTransaction, plus optional secondary/fee payer addresses
+PendingTransactionResponse
+const transaction = await aptos.transaction.build.simple({sender: alice.accountAddress, feePayer: true ...})
const senderAuthenticator = alice.signTransactionWithAuthenticator(transaction)
const pendingTransaction = await aptos.signAndSubmitAsFeePayer({
senderAuthenticator,
feePayer: bob,
transaction,
})
+
+
+Sign and submit a single signer transaction to the blockchain. +This function allows you to execute a transaction after signing it with the specified account.
+The arguments for signing and submitting the transaction.
+PendingTransactionResponse
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for sending the transaction
const transaction = await aptos.transaction.build.simple({
sender: sender.accountAddress,
data: {
function: "0x1::aptos_account::transfer",
functionArguments: [ "0x1", 100 ], // replace with a real account address
},
});
// Sign and submit the transaction
const pendingTransaction = await aptos.signAndSubmitTransaction({
signer: sender,
transaction,
});
console.log(pendingTransaction);
}
runExample().catch(console.error);
+
+
+Sign a transaction as a fee payer that can later be submitted to the chain. +This function ensures that the transaction is marked with the fee payer's address, allowing it to be processed correctly.
+The arguments for signing the transaction.
+The fee payer signer account.
+A raw transaction to sign on. This transaction must include a feePayerAddress
property.
AccountAuthenticator - The authenticator for the signed transaction.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
const sender = Account.generate(); // Generate a new account for the fee payer
const transaction = await aptos.transaction.build.simple({
// All transactions on Aptos are implemented via smart contracts.
function: "0x1::aptos_account::transfer",
functionArguments: [sender.accountAddress, 100],
feePayerAddress: sender.accountAddress, // Set the fee payer address
});
const signedTransaction = await aptos.transaction.signAsFeePayer({
signer: sender,
transaction,
});
console.log("Signed transaction as fee payer:", signedTransaction);
}
runExample().catch(console.error);
+
+
+Waits for a transaction to move past the pending state and provides the transaction response. +There are 4 cases.
+checkSuccess
is true, the function will throw a FailedTransactionError
+If checkSuccess
is false, the function will resolve with the transaction response where the success
field is false.args.options.timeoutSecs
seconds.
+Optional
options?: WaitForTransactionOptionsOptional parameters for waiting behavior.
+The hash of a transaction previously submitted to the blockchain.
+The transaction on-chain response.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
async function runExample() {
// Wait for a transaction to complete using its hash
const transactionHash = "0x123"; // replace with a real transaction hash
const transactionResponse = await aptos.waitForTransaction({
transactionHash,
options: {
timeoutSecs: 30, // specify your own timeout if needed
checkSuccess: true,
},
});
console.log(transactionResponse);
}
runExample().catch(console.error);
+
+
+Minimal EventEmitter
interface that is molded against the Node.js
+EventEmitter
interface.
Initializes a new instance of the Aptos client with the provided configuration settings. +This allows you to interact with the Aptos blockchain using the specified network and options.
+The configuration settings for the Aptos client.
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
async function runExample() {
// Create a configuration for the Aptos client
const config = new AptosConfig({
network: Network.TESTNET, // specify the network to use
nodeUrl: "https://testnet.aptos.dev" // replace with your node URL
});
// Initialize the Aptos client with the configuration
const aptos = new Aptos(config);
console.log("Aptos client initialized successfully.");
}
runExample().catch(console.error);
+
+
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyCalls each of the listeners registered for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Return an array listing the events for which the emitter has registered +listeners.
+Send batch transactions for a single account.
+This function uses a transaction worker that receives payloads to be processed +and submitted to chain. +Note that this process is best for submitting multiple transactions that +don't rely on each other, i.e. batch funds, batch token mints, etc.
+If any worker failure, the functions throws an error.
+An array of transaction payloads
+Optional
options?: Omit<InputGenerateTransactionOptions, "accountSequenceNumber">optional. Transaction generation configurations (excluding accountSequenceNumber)
+The sender account to sign and submit the transaction
+void. Throws if any error
+Return the number of listeners listening to a given event.
+Return the listeners registered for a given event.
+Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanAdd a listener for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyAdd a one-time listener for a given event.
+Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyRemove the listeners of a given event.
+Optional
fn: ((...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanVariants of account authenticators used in transactions. +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414
+Provides reasons for an address was invalid.
+Variants of public keys used in cryptographic operations.
+Specifies the schemes for deriving account addresses from various data sources.
+Derives an address using an AUID, used for objects
+Derives an address from a GUID, used for objects
+Derives an address from another object address
+Derives an address from seed bytes, used for named objects
+Derives an address from seed bytes, used for resource accounts
+Variants of ephemeral certificates used in secure transactions.
+Variants of ephemeral public keys used in cryptographic operations.
+Variants of ephemeral signatures used for secure communication.
+Provides reasons for parsing failures related to hexadecimal values.
+Supported key types and their associated seeds.
+Different MIME types used for data interchange in transactions and responses.
+BCS representation, used for accept type BCS output
+BCS representation, used for transaction submission in BCS input
+JSON representation, used for transaction submission and accept type JSON output
+Variants of private keys that can comply with the AIP-80 standard. +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md
+Supported processor types for the indexer API, sourced from the processor_status table in the indexer database. +https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql
+Variants of script transaction arguments used in Rust, encompassing various data types for transaction processing. +https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11
+Different schemes for signing keys used in cryptographic operations.
+Specifies the signing schemes available for cryptographic operations.
+Variants of transaction authenticators used in the system. +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44
+The payload for various transaction types in the system. +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478
+Different types of transaction responses that can occur in the system.
+Variants of transactions used in the system. +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440
+Events emitted by the transaction worker during its operation, allowing the dapp to respond to various transaction states.
+Error types related to parsing type tags, indicating various issues encountered during the parsing process.
+Variants of type tags used in the system, encompassing various data types and structures. +https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27
+Variants of zero-knowledge proofs used in cryptographic operations.
+select columns of table "current_aptos_names"
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+column name
+select "current_aptos_names_aggregate_bool_exp_bool_and_arguments_columns" columns of table "current_aptos_names"
+select "current_aptos_names_aggregate_bool_exp_bool_or_arguments_columns" columns of table "current_aptos_names"
+Derive a child key from the private key
+The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.
+Options for the Aptos request, including the URL and path.
+The configuration information for the SDK client instance.
+The type of API being accessed, which determines how the response is handled.
+The response from the API request or throws an AptosApiError if the request fails.
+Converts a bigint value into a little-endian byte array of a specified length. +This function is useful for representing large integers in a byte format, which is often required for cryptographic operations +or binary data manipulation.
+The number to convert into bytes.
+The desired length of the resulting byte array.
+A Uint8Array containing the little-endian representation of the bigint value.
+Generates a transaction based on the provided arguments
+Note: we can start with one function to support all different payload/transaction types, +and if to complex to use, we could have function for each type
+Generates a transaction based on the provided arguments. +This function can create both simple and multi-agent transactions, allowing for flexible transaction handling.
+The input arguments for generating the transaction.
+An instance of a transaction, which may include secondary signer addresses and a fee payer address.
+Converts a little-endian byte array into a BigInt. +This function is useful for interpreting byte data as a numerical value in a way that respects the little-endian format.
+The byte array to convert.
+The resulting BigInt representation of the byte array.
+Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI. +This function helps in validating and converting arguments for entry functions based on their expected types.
+The argument to check or convert, which can be either a simple or entry function argument type.
+The expected type tag for the argument.
+The position of the argument in the function call.
+An array of generic type parameters that may be used for conversion.
+Amount is represented in the smallest unit format on chain, this function converts +a human-readable amount format to the smallest unit format
+Amount is represented in the smallest unit format on chain, this function converts +the smallest unit format to a human-readable amount format
+Converts a non-BCS encoded argument into BCS encoded, if necessary. +This function checks the provided argument against the expected parameter type and converts it accordingly.
+The name of the function for which the argument is being converted.
+The ABI (Application Binary Interface) of the function, which defines its parameters.
+The argument to be converted, which can be of various types.
+The index of the argument in the function's parameter list.
+An array of type tags for any generic type parameters.
+Converts a number or a string representation of a number into a number type. +This function is useful for ensuring that the input is in a consistent numeric format, +which can help prevent type mismatches in further processing.
+The input value to be converted. This can be a number, a string representing a number, or any other type.
+Returns the converted number if the input is valid; otherwise, it returns undefined.
+Creates an object address from creator address and seed
+The object creator account address
+The seed in either Uint8Array | string type
+The object account address
+Creates a resource address from creator address and seed
+The creator account address
+The seed in either Uint8Array | string type
+The resource account address
+Creates a token object address from creator address, collection name and token name
+The token creator account address
+The collection name
+The token name
+The token account address
+Derives the appropriate raw transaction type based on the provided transaction details. +This function helps in identifying whether the transaction is a FeePayerRawTransaction, +MultiAgentRawTransaction, or a standard RawTransaction.
+An object representing an Aptos transaction, which may include:
+FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction
+Deserialize a Script Transaction Argument. +This function retrieves and deserializes various types of script transaction arguments based on the provided deserializer.
+The deserializer used to read the script transaction argument.
+The deserialized script transaction argument.
+Fetches the ABI for an entry function from the specified module address. +This function validates if the ABI corresponds to an entry function and retrieves its parameters.
+The address of the module containing the entry function.
+The name of the module containing the entry function.
+The name of the entry function to fetch the ABI for.
+The configuration settings for Aptos.
+An object containing the number of signers, type parameters, and function parameters.
+Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a +specific function within a module.
+The address of the module from which to fetch the function ABI.
+The name of the module containing the function.
+The name of the function whose ABI is to be fetched.
+The configuration settings for Aptos.
+Fetches the ABI for a view function from the specified module address. +This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.
+The address of the module containing the view function.
+The name of the module containing the view function.
+The name of the view function for which to fetch the ABI.
+The configuration settings for Aptos.
+An object containing the type parameters, parameters, and return types of the view function.
+Finds the index of the first non-signer argument in the function ABI parameters.
+A function is often defined with a signer
or &signer
arguments at the start, which are filled in
+by signatures and not by the caller. This function helps identify the position of the first argument that
+can be provided by the caller, allowing for easier handling of function parameters.
The ABI of the function to analyze.
+The index of the first non-signer argument, or the length of the parameters array if none are found.
+Generates a raw transaction that can be sent to the Aptos network.
+The arguments for generating the raw transaction.
+The configuration for the Aptos network.
+Optional
feeThe address of the fee payer for sponsored transactions.
+Optional
options?: InputGenerateTransactionOptionsOptional parameters for transaction generation.
+The transaction payload, which can be created using generateTransactionPayload().
+The transaction's sender account address as a hex input.
+RawTransaction - The generated raw transaction.
+Generate a signed transaction ready for submission to the blockchain. +This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments.
+The input data required to generate the signed transaction.
+A Uint8Array representing the signed transaction in bytes.
+Generate a signed transaction for simulation before submitting it to the chain. +This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior.
+The input data required to generate the signed transaction for simulation.
+A signed serialized transaction that can be simulated.
+Generates the 'signing message' form of a message to be signed. +This function combines a domain separator with the byte representation of the message to create a signing message.
+The byte representation of the message to be signed and sent to the chain.
+A domain separator that starts with 'APTOS::'.
+The Uint8Array of the signing message.
+An object that has a BCS serialized form.
+The Uint8Array of the signing message.
+Generates the 'signing message' form of a transaction by deriving the type of transaction and applying the appropriate domain +separator based on the presence of a fee payer or secondary signers.
+A transaction that is to be signed, which can include a fee payer address or secondary signer addresses.
+The Uint8Array of the signing message.
+Builds a transaction payload based on the data argument and returns +a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction
+This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI
+Builds a transaction payload based on the provided arguments and returns a transaction payload.
+This function uses the RemoteABI by default, but can also utilize a specified ABI.
+When we call our generateTransactionPayload
function with the relevant type properties,
+Typescript can infer the return type based on the appropriate function overload.
The input data for generating the transaction payload.
+TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript, +TransactionPayloadMultiSig, or TransactionPayloadEntryFunction.
+Generates a transaction payload using the provided ABI and function details. +This function helps create a properly structured transaction payload for executing a specific function on a module.
+The input data required to generate the transaction payload.
+Generates a user transaction hash for the provided transaction payload, which must already have an authenticator. +This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data.
+The input data required to submit the transaction.
+Generates the payload for a view function call using the provided arguments. +This function helps in preparing the necessary data to interact with a specific view function on the blockchain.
+The input data required to generate the view function payload.
+The generated payload for the view function call.
+Generates a payload for a view function call using the provided ABI and arguments. +This function ensures that the type arguments and function arguments are correctly formatted +and match the expected counts as defined in the ABI.
+The input data for generating the view function payload.
+Executes a GET request to retrieve data based on the provided options.
+The options for the GET request.
+The response from the GET request.
+Retrieves data from the Aptos full node using the provided options.
+The options for the request to the Aptos full node.
+A promise that resolves with the response from the Aptos full node.
+Makes a GET request to the Aptos Pepper service to retrieve data.
+The options for the request.
+AptosResponse - The response from the Aptos Pepper service.
+Splits a function identifier into its constituent parts: module address, module name, and function name. +This function helps in validating and extracting details from a function identifier string.
+The function identifier string in the format "moduleAddress::moduleName::functionName".
+An object containing the module address, module name, and function name.
+Parses a JWT and returns the 'iss', 'aud', and 'uid' values.
+The arguments for parsing the JWT.
+The JWT to parse.
+Optional
uidThe key to use for the 'uid' value; defaults to 'sub'.
+The 'iss', 'aud', and 'uid' values from the JWT.
+Retrieves the configuration parameters for Keyless Accounts on the blockchain, including the verifying key and the maximum +expiry horizon.
+The arguments for retrieving the keyless configuration.
+The Aptos configuration object containing network details.
+Optional
options?: LedgerVersionArgOptional parameters for the request.
+KeylessConfiguration - The configuration object containing the verifying key and maximum expiry horizon.
+Optional
jwkOptional
options?: LedgerVersionArgHashes a string to a field element via Poseidon hashing. +This function is useful for converting a string into a fixed-size hash that can be used in cryptographic applications.
+The string to be hashed.
+The maximum size in bytes for the resulting hash.
+bigint - The result of the hash.
+Determines if the given transaction response is of the type Block Epilogue.
+The transaction response to evaluate.
+A boolean indicating whether the response is a Block Epilogue transaction.
+Determine if the given transaction response is of type BlockMetadata.
+The transaction response to evaluate.
+A boolean indicating whether the response is a BlockMetadata transaction.
+Determines if the provided argument is of type boolean. +This can help in validating input types before processing them further.
+The argument to check, which can be of various types.
+A boolean indicating whether the argument is a boolean.
+Checks if an ED25519 signature is non-canonical. +This function helps determine the validity of a signature by verifying its canonical form.
+The signature to be checked for canonicality.
+A boolean indicating whether the signature is non-canonical.
+Comes from Aptos Core +https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85
+Determine if the provided signature is an Ed25519 signature. +This function checks for the presence of the "signature" property +and verifies that its value is "ed25519_signature".
+The transaction signature to be checked.
+A boolean indicating whether the signature is an Ed25519 signature.
+Checks if the provided argument is empty, meaning it is either null or undefined.
+The argument to check for emptiness.
+A boolean indicating whether the argument is empty.
+Determines if the provided argument is a valid encoded entry function argument type. +This function helps validate that the argument conforms to the expected types for entry function parameters.
+The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.
+Determines whether the given object is an encoded struct type with the following properties:
+Determine if the provided signature is a fee payer signature.
+The transaction signature to evaluate.
+A boolean indicating whether the signature is a fee payer signature.
+Determines if the given transaction response is a Genesis transaction.
+The transaction response to evaluate.
+A boolean indicating whether the transaction is a Genesis transaction.
+Determines if the provided argument is a large number, which can be a number, bigint, or string representation of a number.
+The argument to check, which can be of type number, bigint, or string.
+Determine if the provided transaction signature is a multi-agent signature.
+The transaction signature to evaluate.
+A boolean indicating whether the signature is a multi-agent signature.
+Determine if the provided signature is of type "multi_ed25519_signature".
+The transaction signature to check.
+A boolean indicating whether the signature is a multi-ed25519 signature.
+Determines if the provided argument is of type number.
+The argument to check, which can be of various types.
+A boolean indicating whether the argument is a number.
+Determine if the given transaction response is currently pending.
+The transaction response to evaluate.
+A boolean indicating whether the transaction is pending.
+Determines if the provided argument contains script data input by checking for the presence of bytecode.
+The input data to be checked, which can either be a payload with remote ABI or a standard payload.
+Determine if the provided signature is a valid secp256k1 ECDSA signature.
+The transaction signature to validate.
+A boolean indicating whether the signature is a secp256k1 ECDSA signature.
+Determines if the provided transaction response is a state checkpoint transaction.
+The transaction response to evaluate.
+A boolean indicating whether the transaction response is of type StateCheckpoint.
+Determines if the given transaction response is a user transaction.
+The transaction response to evaluate.
+A boolean indicating whether the transaction is of type User.
+Validate a BIP-44 derivation path string to ensure it meets the required format. +This function checks if the provided path adheres to the BIP-44 standard for Secp256k1. +Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index} +for Secp256k1
+Note that for Secp256k1, the last two components must be non-hardened.
+The path string to validate (e.g. m/44'/637'/0'/0/0
).
Aptos derive path is 637
+Parse and validate a path that is compliant to SLIP-0010 and BIP-44 +in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'. +See SLIP-0010 https://github.com/satoshilabs/slips/blob/master/slip-0044.md +See BIP-44 https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
+Note that for Ed25519, all components must be hardened. +This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism. +Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b. +This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘), +with the hash function breaking the homomorphism.
+The derivation path string to validate (e.g. m/44'/637'/0'/0'/0'
).
Determine if the given transaction response is of type Validator.
+The transaction response to evaluate.
+A boolean indicating whether the transaction response is a Validator type.
+Normalizes an instance of a class by deserializing it from its byte representation.
+This function allows the instanceof
operator to work correctly when the input objects originate from a different bundle.
The class of the object to normalize.
+The instance to normalize.
+Creates a new StructTag for the Object type with the specified type argument. +This function helps in defining a structured representation of an Object with a specific type.
+The type tag that specifies the type of the Object.
+Creates a new StructTag for the Option type with the specified type argument. +This can help in defining a specific instance of an Option type in your application.
+The type tag that specifies the type of the value contained in the Option.
+Pads and packs the given byte array to a specified maximum size and appends its length. +This function ensures that the byte array does not exceed the maximum size, throwing an error if it does. +It is useful for preparing byte data for further processing or transmission by ensuring a consistent format.
+The byte array to be padded and packed.
+The maximum allowed size for the byte array.
+A new Uint8Array that contains the padded and packed bytes along with the length of the original byte array.
+Convert an encoded struct to a MoveStructId.
+The struct with account_address, module_name, and struct_name properties
+The MoveStructId
+Parses a type string into a structured representation of type tags, accommodating various formats including generics and +nested types.
+This function can help you accurately interpret type strings, which can include simple types, standalone structs, and complex +nested generics. +It supports multiple generics, spacing within generics, and nested generics of varying depths. +All types are made of a few parts they're either:
+There are a few more special cases that need to be handled, however.
+The string representation of the type to be parsed.
+Optional
options: { Optional settings for parsing behavior.
+Optional
allowA flag indicating whether to allow generics in the parsing process.
+The parsed type tag representation.
+Hashes up to 16 scalar elements via the Poseidon hashing algorithm. +Each element must be scalar fields of the BN254 elliptic curve group.
+An array of elements to be hashed, which can be of type number, bigint, or string.
+bigint - The result of the hash.
+Executes a POST request to the specified URL with the provided options.
+The options for the POST request.
+The response from the POST request.
+Sends a request to the Aptos faucet to obtain test tokens. +This function modifies the provided configuration to ensure that the API_KEY is not included in the request.
+The options for the request.
+Sends a request to the Aptos full node using the specified options. +This function allows you to interact with the Aptos blockchain by sending requests to the full node.
+The options for the request.
+Sends a request to the Aptos indexer with the specified options. +This function allows you to interact with the Aptos indexer and customize the request using various configurations.
+The options for the request to the Aptos indexer.
+Makes a post request to the pepper service.
+The options for the request.
+A promise that resolves to the response from the pepper service.
+Sends a request to the Aptos proving service with the specified options.
+The options for the request to the Aptos proving service.
+Sends a request using the specified options and returns the response.
+The options for the request.
+The client used to make the request.
+The response from the request.
+Convert type arguments to only type tags, allowing for string representations of type tags.
+Optional
typeArguments: TypeArgument[]An optional array of type arguments that may include string representations.
+An array of TypeTag objects derived from the provided type arguments.
+Throws an error indicating a type mismatch for a specified argument position. +This function helps in debugging by providing clear feedback on expected types.
+The type that was expected for the argument.
+The position of the argument that caused the type mismatch.
+The TypeScript SDK allows you to connect, explore, and interact on the Aptos blockchain. You can use it to request data, send transactions, set up test environments, and more!
+Install with your favorite package manager such as npm, yarn, or pnpm:
+pnpm install @aptos-labs/ts-sdk
+
+
+You can add the SDK to your web application using a script tag:
+<script src="https://unpkg.com/@aptos-labs/ts-sdk/dist/browser/index.global.js" />
+
+
+Then, the SDK can be accessed through window.aptosSDK
.
Create an Aptos
client in order to access the SDK's functionality.
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"
// You can use AptosConfig to choose which network to connect to
const config = new AptosConfig({ network: Network.TESTNET });
// Aptos is the main entrypoint for all functions
const aptos = new Aptos(config);
+
+
+const fund = await aptos.getAccountInfo({ accountAddress: "0x123" });
const modules = await aptos.getAccountModules({ accountAddress: "0x123" });
const tokens = await aptos.getAccountOwnedTokens({ accountAddress: "0x123" });
+
+
+++Note: We introduce a Single Sender authentication (as introduced in AIP-55). Generating an account defaults to Legacy Ed25519 authentication with the option to use the Single Sender unified authentication.
+
const account = Account.generate(); // defaults to Legacy Ed25519
const account = Account.generate({ scheme: SigningSchemeInput.Secp256k1Ecdsa }); // Single Sender Secp256k1
const account = Account.generate({ scheme: SigningSchemeInput.Ed25519, legacy: false }); // Single Sender Ed25519
+
+
+// Create a private key instance for Ed25519 scheme
const privateKey = new Ed25519PrivateKey("myEd25519privatekeystring");
// Or for Secp256k1 scheme
const privateKey = new Secp256k1PrivateKey("mySecp256k1privatekeystring");
// Derive an account from private key
// This is used as a local calculation and therefore is used to instantiate an `Account`
// that has not had its authentication key rotated
const account = await Account.fromPrivateKey({ privateKey });
// Also, can use this function that resolves the provided private key type and derives the public key from it
// to support key rotation and differentiation between Legacy Ed25519 and Unified authentications
// Read more https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/api/account.ts#L364
const aptos = new Aptos();
const account = await aptos.deriveAccountFromPrivateKey({ privateKey });
+
+
+// Create a private key instance for Ed25519 scheme
const privateKey = new Ed25519PrivateKey("myEd25519privatekeystring");
// Or for Secp256k1 scheme
const privateKey = new Secp256k1PrivateKey("mySecp256k1privatekeystring");
// Derive an account from private key and address
// create an AccountAddress instance from the account address string
const address = AccountAddress.from("myaccountaddressstring");
// Derieve an account from private key and address
const account = await Account.fromPrivateKeyAndAddress({ privateKey, address });
+
+
+const path = "m/44'/637'/0'/0'/1";
const mnemonic = "various float stumble...";
const account = Account.fromDerivationPath({ path, mnemonic });
+
+
+/**
* This example shows how to use the Aptos SDK to send a transaction.
* Don't forget to install @aptos-labs/ts-sdk before running this example!
*/
import {
Account,
Aptos,
AptosConfig,
Network,
} from "@aptos-labs/ts-sdk";
async function example() {
console.log("This example will create two accounts (Alice and Bob) and send a transaction transfering APT to Bob's account.");
// 0. Setup the client and test accounts
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
let alice = Account.generate();
let bob = Account.generate();
console.log("=== Addresses ===\n");
console.log(`Alice's address is: ${alice.accountAddress}`);
console.log(`Bob's address is: ${bob.accountAddress}`);
console.log("\n=== Funding accounts ===\n");
await aptos.fundAccount({
accountAddress: alice.accountAddress,
amount: 100_000_000,
});
await aptos.fundAccount({
accountAddress: bob.accountAddress,
amount: 100,
});
console.log("Funded Alice and Bob's accounts!")
// 1. Build
console.log("\n=== 1. Building the transaction ===\n");
const transaction = await aptos.transaction.build.simple({
sender: alice.accountAddress,
data: {
// All transactions on Aptos are implemented via smart contracts.
function: "0x1::aptos_account::transfer",
functionArguments: [bob.accountAddress, 100],
},
});
console.log("Built the transaction!")
// 2. Simulate (Optional)
console.log("\n === 2. Simulating Response (Optional) === \n")
const [userTransactionResponse] = await aptos.transaction.simulate.simple({
signerPublicKey: alice.publicKey,
transaction,
});
console.log(userTransactionResponse)
// 3. Sign
console.log("\n=== 3. Signing transaction ===\n");
const senderAuthenticator = aptos.transaction.sign({
signer: alice,
transaction,
});
console.log("Signed the transaction!")
// 4. Submit
console.log("\n=== 4. Submitting transaction ===\n");
const submittedTransaction = await aptos.transaction.submit.simple({
transaction,
senderAuthenticator,
});
console.log(`Submitted transaction hash: ${submittedTransaction.hash}`);
// 5. Wait for results
console.log("\n=== 5. Waiting for result of transaction ===\n");
const executedTransaction = await aptos.waitForTransaction({ transactionHash: submittedTransaction.hash });
console.log(executedTransaction)
};
example();
+
+
+If you see import error when you do this
+import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
+
+
+It could be your tsconfig.json
is not using node
. Make sure your moduleResolution
in the tsconfig.json
is set to node
instead of bundler
.
If you found a bug or would like to request a feature, please file an issue. +If, based on the discussion on an issue you would like to offer a code change, please make a pull request. +If neither of these describes what you would like to contribute, checkout out the contributing guide.
+Sends a request to the specified URL with the given options.
+The options for the request.
+Represents a client for making requests to a service provider.
+Optional
bodyOptional
contentOptional
headersOptional
originOptional
overridesOptional
paramsArguments for creating an Account
from a private key when the key type is unknown at compile time.
Arguments for creating an Ed25519Account
from an Ed25519PrivateKey
.
+To use the SingleKey authentication scheme, set legacy
to false.
Arguments for creating a SingleKeyAccount
using an Ed25519PrivateKey
.
+The legacy
property must be set to false to utilize the SingleKey
authentication scheme.
Arguments for creating a SingleKeyAccount
from a supported private key, excluding Ed25519PrivateKey
.
+The legacy
argument is always false and cannot be set to true.
This interface exists to define Deserializable
Deserializes the buffered bytes into an instance of the specified class type.
+This function provides an alternative syntax for deserialization, allowing users to call
+deserializer.deserialize(MyClass)
instead of MyClass.deserialize(deserializer)
.
The deserializer instance with the buffered bytes.
+The deserialized value of class type T.
+Arguments required to create an instance of an Ed25519 signer.
+Arguments for creating an Ed25519 signer from a derivation path.
+Represents an argument for entry functions, providing methods to serialize the argument +to BCS-serialized bytes and convert it to different formats.
+Converts the BCS-serialized bytes of an argument into a hexadecimal representation. +This function is useful for obtaining a Hex instance that encapsulates the BCS-serialized bytes, +allowing for easier manipulation and representation of the data.
+A Hex instance containing the BCS-serialized bytes.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Arguments for generating a multi-agent transaction, used in the generateTransaction()
method of the transaction builder flow.
Holds user data input for generating a multi-agent transaction.
+Arguments for generating a single signer raw transaction, used in the transaction builder flow.
+Holds user input data for generating a single signer transaction.
+Holds user data input for submitting a transaction.
+An interface which defines if an Account utilizes Keyless signing.
+Abstract
signAbstract
signSign the given transaction using the available signing capabilities.
+the transaction to be signed
+Signature
+Abstract
signSign a transaction using the available signing capabilities.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Abstract
signSign a message using the available signing capabilities.
+the signing message, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Verify the given message and signature with the public key. +This function helps ensure the integrity and authenticity of a message by validating its signature.
+The arguments for verifying the signature.
+A boolean indicating whether the signature is valid.
+Arguments for deriving a private key using a mnemonic phrase and a specified BIP44 path.
+Represents an argument for script functions, providing methods to serialize and convert to bytes.
+Serialize an argument to BCS-serialized bytes.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Arguments for generating a single key signer.
+Represents an argument for entry functions, providing methods to serialize the argument +to BCS-serialized bytes and convert it to different formats.
+Converts the BCS-serialized bytes of an argument into a hexadecimal representation. +This function is useful for obtaining a Hex instance that encapsulates the BCS-serialized bytes, +allowing for easier manipulation and representation of the data.
+A Hex instance containing the BCS-serialized bytes.
+Serialize an argument to BCS-serialized bytes.
+The serializer instance used for serialization.
+Serialize an argument to BCS-serialized bytes. +Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains +the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
+The serializer used to convert the argument.
+Serialize an argument to BCS-serialized bytes as a type aware byte sequence. +The byte sequence contains an enum variant index followed by the BCS-serialized +bytes for a typed argument.
+Defines the events emitted by the transaction worker during various stages of transaction processing. * +transactionSent - Emitted when a transaction is successfully sent. +transactionSendFailed - Emitted when sending a transaction fails. +transactionExecuted - Emitted when a transaction is successfully executed. +transactionExecutionFailed - Emitted when executing a transaction fails. +executionFinish - Emitted when the execution process is finished.
+Represents the arguments required to verify a digital signature.
+Options for creating a collection, allowing customization of various attributes such as supply limits, mutability of metadata, +and royalty settings.
+Optional
maxOptional
mutableOptional
mutableOptional
mutableOptional
mutableOptional
mutableOptional
mutableOptional
mutableURIOptional
royaltyOptional
royaltyOptional
tokensOptional
tokensRest
...args: ArgsArguments for retrieving the domains associated with a specific account.
+Optional
optionsArguments for retrieving account names based on the specified account address.
+Optional
optionsArguments for retrieving subdomains associated with a specific account.
+Optional
optionsArguments for retrieving subdomains associated with a specific domain.
+Optional
optionsThe AsyncQueue class is an async-aware data structure that provides a queue-like +behavior for managing asynchronous tasks or operations. +It allows to enqueue items and dequeue them asynchronously. +This is not thread-safe, but it is async concurrency safe, and +it does not guarantee ordering for those that call into and await on enqueue.
+Options for querying names, including pagination, ordering, and filtering criteria.
+Optional
optionsParameters for registering a name in the Aptos network.
+The input for an account address, which can be either a hexadecimal string or a standard account address.
+The data associated with an account, including its sequence number.
+The union of all single account signatures, including Ed25519, Secp256k1, and MultiEd25519 signatures.
+A number or a bigint value.
+Unified type that holds all the return interfaces when generating different transaction types
+Holds all return interfaces for generating different transaction types.
+The transaction payload type generated from the generateTransactionPayload()
function, which can be an entry function,
+script, or multi-signature payload.
The API request type
+the url to make the request to, i.e. https://fullnode.devnet.aptoslabs.com/v1
+Configuration options for initializing the SDK, allowing customization of its behavior and interaction with the Aptos network.
+A list of supported Authentication Key schemes in Aptos, consisting of combinations of signing schemes and derive schemes.
+A Block type
+Optional
transactions?: TransactionResponse[]The transactions in the block in sequential order
+Describes the gas state of the block, indicating whether the block gas limit has been reached.
+A transaction executed at the end of a block that tracks data from the entire block.
+Final state of resources changed by the transaction
+Whether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+The structure representing a blockchain block with its height.
+Final state of resources changed by the transaction
+The events emitted at the block creation
+The indices of the proposers who failed to propose
+Previous block votes
+Whether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+A configuration object for requests to the server, including API key, extra headers, and cookie handling options.
+General type definition for client headers.
+The response for a committed transaction, which can be one of several transaction types.
+The decoded data for a table, including its key in JSON format.
+Key of table in JSON
+Type of key
+Value of table in JSON
+Type of value
+Data for a deleted table entry.
+Deleted key
+Deleted key type
+Contains the derived cryptographic key as a Uint8Array.
+Deserializes a serialized object using the provided deserializer. +This function allows you to reconstruct an object from its serialized form.
+An instance of the Deserializer used to read the serialized data.
+The set of direct write operations, identified by a type string.
+Interface for an Entry function's ABI, enabling type checking and input conversion for ABI-based transaction submissions.
+Entry function arguments for building a raw transaction using BCS serialized arguments.
+The response payload for an entry function, containing the type of the entry.
+Arguments of the function
+Type arguments of the function
+The structure for an event, identified by a unique GUID.
+The payload for when the worker has finished its job.
+The payload for a failure event.
+A configuration object for a faucet, including optional authentication and headers for requests.
+A configuration object for a Fullnode, allowing for the inclusion of extra headers in requests.
+Data needed for a generic function ABI, applicable to both view and entry functions.
+The output of the estimate gas API, including the deprioritized estimate for the gas unit price.
+Optional
deprioritized_The deprioritized estimate for the gas unit price
+The current estimate for the gas unit price
+Optional
prioritized_The prioritized estimate for the gas unit price
+Input type to generate an account using the Ed25519 signing scheme.
+Input type to generate an account with a Single Signer using Secp256k1.
+The payload for the genesis block containing the type of the payload.
+The response for a genesis transaction, indicating the type of transaction.
+Final state of resources changed by the transaction
+Events emitted during genesis
+Optional
state_Whether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+The response containing the current Aptos names from the GetNamesQuery.
+The current balances of fungible assets for an account.
+The response structure for retrieving account collections associated with owned tokens.
+The response containing the current token ownerships for an account from a specific collection.
+The response structure for querying tokens owned by an account.
+Options for making a request to the Aptos API, excluding the "type" field.
+The response structure for retrieving user transactions from the top of the blockchain.
+The response structure for retrieving data from the current collections.
+The current balances of fungible assets for a specific query.
+The response structure for retrieving the current token ownership details.
+The response containing the delegated staking activities from the query.
+The response containing the events from the GetEventsQuery.
+The response containing the activities related to fungible assets.
+The response containing metadata for a fungible asset.
+The number of active delegators per pool in response to a query.
+CUSTOM RESPONSE TYPES FOR THE END USER
+To provide a good dev exp, we build custom types derived from the +query types to be the response type the end developer/user will +work with.
+These types are used as the return type when calling a sdk api function +that calls the function that queries the server (usually under the /api/ folder)
+The response containing the current token ownerships for a user.
+The status of the processor as returned by the GetProcessorStatusQuery.
+Options for making a GET request, including configuration for the API client.
+Optional
acceptThe accepted content type of the response of the API
+The config for the API client
+Optional
contentThe content type of the request body
+The name of the API method
+Optional
overrides?: ClientConfigSpecific client overrides for this request to override aptosConfig
+Optional
params?: Record<string, The query parameters for the request
+The URL path to the API method
+The type of API endpoint to call e.g. fullnode, indexer, etc
+The response structure for retrieving items from a table.
+The metadata for table items retrieved from a query.
+The response structure for retrieving token activity data.
+The response structure for retrieving token data, containing the current token information.
+The GraphQL query to pass into the queryIndexer
function.
Hexadecimal data input for functions, supporting both string and Uint8Array formats.
+An Indexer configuration object for sending requests with additional headers.
+The data needed to generate an Entry Function payload.
+The input data for an entry function, including its associated ABI.
+Combines input function data with Aptos configuration for remote ABI interactions.
+A unified type for generating various transaction types.
+Unified type holding user data input interfaces for generating various transaction types.
+Optional options to set when generating a transaction, including a maximum gas amount.
+The data needed to generate a transaction payload for Entry Function, Script, or Multi Sig types.
+The payload for generating a transaction, which can be either an entry function or a multi-signature transaction.
+The payload for generating a transaction, which can be either script data, entry function data with remote ABI, or +multi-signature data.
+The data needed to generate a Multi Sig payload
+The data needed to generate a Multi Sig payload, including the multisig address.
+The data needed to generate a Multi Sig payload, including the multisig address.
+The data needed to generate a Script payload.
+The data required to simulate a transaction, typically generated by generateTransaction()
.
Optional
feeFor a fee payer transaction (aka Sponsored Transaction)
+Optional
options?: InputSimulateTransactionOptionsOptional
secondaryFor a fee payer or multi-agent transaction that requires additional signers in
+For a single signer transaction
+The transaction to simulate, probably generated by generateTransaction()
Options for simulating a transaction input, including whether to estimate the gas unit price.
+The data needed to generate a View Function payload.
+Data needed to generate a view function, including the fetched ABI.
+Data required to create a view function payload and retrieve the remote ABI, including Aptos configuration.
+The data needed to generate a View Function payload in JSON format.
+Information about the current blockchain ledger, including its chain ID.
+Chain ID of the current chain
+Optional
git_Git hash of the build of the API endpoint. Can be used to determine the exact +software version used by the API endpoint.
+The ledger version of transactions, defaulting to the latest version if not specified.
+A string representing a Move address.
+Move function
+Generic type params associated with the Move function
+Whether the function can be called as an entry function directly in a transaction
+Whether the function is a view function or not
+Parameters associated with the move function
+Return type of the function
+Move abilities associated with the generic type parameter of a function.
+The move function containing its name. Same as MoveStructId since it reads weird to take a StructId for a Function.
+A Move module
+Public functions of the module
+Friends of the module
+Structs of the module
+A Move module containing an address.
+A string representation of a Move module, formatted as module_name::function_name
.
+Module names are case-sensitive.
The type for identifying objects to be moved within the system.
+The type for move options, which can be a MoveType, null, or undefined.
+The bytecode for a Move script.
+A move struct
+Abilities associated with the struct
+Fields associated with the struct
+Generic types associated with the struct
+Whether the struct is a module event (aka v2 event). This will be false for v1 +events because the value is derived from the #[event] attribute on the struct in +the Move source code. This attribute is only relevant for v2 events.
+Whether the struct is a native struct of Move
+A field in a Move struct, identified by its name.
+A structure representing a move with a name.
+A union type that encompasses various data types used in Move, including primitive types, address types, object types, and +arrays of MoveType.
+A string representing a 128-bit unsigned integer in the Move programming language.
+A 16-bit unsigned integer used in the Move programming language.
+A string representation of a 256-bit unsigned integer used in Move programming.
+A 32-bit unsigned integer type used in Move programming.
+A string representation of a 64-bit unsigned integer used in Move programming.
+A number representing a Move uint8 type.
+Possible Move values acceptable by move functions (entry, view)
+Map of a Move value to the corresponding TypeScript value
+Bool -> boolean
u8, u16, u32 -> number
u64, u128, u256 -> string
String -> string
Address -> 0x${string}
Struct - 0x${string}::${string}::${string}
Object -> 0x${string}
Vector -> Array<MoveValue>
Option -> MoveValue | null | undefined
The response payload for a multisig transaction, containing the type of the transaction.
+A generic type that being passed by each function and holds an +array of properties we can sort the query by
+Specifies the order direction for sorting, including options for handling null values.
+Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function, +this type is returned from "defensive" functions like isValid.
+Optional
invalidIf valid is false, this will be a code explaining why parsing failed.
+Optional
invalidIf valid is false, this will be a string explaining why parsing failed.
+True if valid, false otherwise.
+The response for a pending transaction, indicating that the transaction is still being processed.
+Options for posting a request to Aptos, excluding the type field.
+Options for making a POST request, including the API client configuration.
+Optional
acceptThe accepted content type of the response of the API
+The config for the API client
+Optional
body?: anyThe body of the request, should match the content type of the request
+Optional
contentThe content type of the request body
+The name of the API method
+Optional
overrides?: ClientConfigSpecific client overrides for this request to override aptosConfig
+Optional
params?: Record<string, The query parameters for the request
+The URL path to the API method
+The type of API endpoint to call e.g. fullnode, indexer, etc
+Script function arguments for building raw transactions using BCS serialized arguments.
+The payload for a script response, containing the type of the script.
+Arguments of the function
+Type arguments of the function
+The set of properties for writing scripts, including the type of script.
+Entry function arguments for building a raw transaction using remote ABI, supporting various data types including primitives and arrays.
+The arguments for generating a single key signer from a specified derivation path.
+The response for a state checkpoint transaction, indicating the type of transaction.
+Final state of resources changed by the transaction
+Whether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+The payload for a success event.
+The token standard to query for, which can be either version "v1" or "v2".
+The signature for a transaction using the Ed25519 algorithm.
+The signature of the fee payer in a transaction.
+The other involved parties' addresses
+The associated signatures, in the same order as the secondary addresses
+The structure for a multi-agent signature in a transaction.
+The other involved parties' addresses
+The associated signatures, in the same order as the secondary addresses
+The structure for a multi-signature transaction using Ed25519.
+The public keys for the Ed25519 signature
+Signature associated with the public keys in the same order
+The number of signatures required for a successful transaction
+The payload for a transaction response, which can be an entry function, script, or multisig payload.
+The response for a transaction, which can be either pending or committed.
+The structure for a Secp256k1 signature in a transaction.
+JSON representations of transaction signatures returned from the node API.
+Inputs for Entry functions, view functions, and scripts, which can be a string representation of various types including +primitive types, vectors, and structured types.
+This can be a string version of the type argument such as:
+A 128-bit unsigned integer used for precise arithmetic operations.
+A 16-bit unsigned integer.
+A 256-bit unsigned integer used for precise numerical calculations.
+A 32-bit unsigned integer.
+A 64-bit unsigned integer value.
+BCS types
+The response structure for a user transaction.
+Final state of resources changed by the transaction
+Events generated by the transaction
+Optional
signature?: TransactionSignatureWhether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+The response for a validator transaction, indicating the type of transaction.
+Final state of resources changed by the transaction
+The events emitted by the validator transaction
+Whether the transaction was successful
+The VM status of the transaction, can tell useful information in a failure
+Interface for a view function's ABI, providing type checking and input conversion for ABI-based transaction submissions.
+The payload sent to the fullnode for a JSON view request.
+Options for configuring the behavior of the waitForTransaction() function.
+A union type that encompasses both script and direct write sets for data operations.
+The structure for a module deletion change in a write set.
+State key hash
+The payload for a resource deletion in a write set change.
+The payload for a write set change that deletes a table item.
+The structure for a write module change in a write set.
+The resource associated with a write set change, identified by its type.
+The structure for a write operation on a table in a write set change.
+Options for handling errors in the Aptos API.
+Boolean expression to compare columns of type "bigint". All fields are combined with logical 'AND'.
+Boolean expression to compare columns of type "Boolean". All fields are combined with logical 'AND'.
+Boolean expression to filter rows from the table "current_aptos_names". All fields are combined with a logical 'AND'.
+Boolean expression to filter rows from the table "current_unified_fungible_asset_balances_to_be_renamed". All fields are combined with a logical 'AND'.
+object
should be in either of the following forms:
interface EventTypes {
'event-with-parameters': any[]
'event-with-example-handler': (...args: any[]) => void
}
+
+
+Boolean expression to filter rows from the table "events". All fields are combined with a logical 'AND'.
+Boolean expression to filter rows from the table "fungible_asset_activities". All fields are combined with a logical 'AND'.
+Boolean expression to filter rows from the table "fungible_asset_metadata". All fields are combined with a logical 'AND'.
+The response containing the Groth16 verification key, including the alpha_g1 component.
+Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'.
+Boolean expression to compare columns of type "jsonb". All fields are combined with logical 'AND'.
+Optional
_cast?: InputMaybe<JsonbCastExp>Optional
_contained_is the column contained in the given json value
+Optional
_contains?: InputMaybe<Scalars["jsonb"]["input"]>does the column contain the given json value at the top level
+Optional
_eq?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_gt?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_gte?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_has_does the string exist as a top-level key in the column
+Optional
_has_do all of these strings exist as top-level keys in the column
+Optional
_has_do any of these strings exist as top-level keys in the column
+Optional
_in?: InputMaybe<Scalars["jsonb"]["input"][]>Optional
_is_Optional
_lt?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_lte?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_neq?: InputMaybe<Scalars["jsonb"]["input"]>Optional
_nin?: InputMaybe<Scalars["jsonb"]["input"][]>Boolean expression to compare columns of type "numeric". All fields are combined with logical 'AND'.
+Accepted property value types for user input, including boolean, number, bigint, string, AccountAddress, and Uint8Array.
+To pass in an Array, use Uint8Array type
+for example new MoveVector([new MoveString("hello"), new MoveString("world")]).bcsToBytes()
All built-in and custom scalars, mapped to their actual values
+Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'.
+Optional
_eq?: InputMaybe<Scalars["String"]["input"]>Optional
_gt?: InputMaybe<Scalars["String"]["input"]>Optional
_gte?: InputMaybe<Scalars["String"]["input"]>Optional
_ilike?: InputMaybe<Scalars["String"]["input"]>does the column match the given case-insensitive pattern
+Optional
_in?: InputMaybe<Scalars["String"]["input"][]>Optional
_iregex?: InputMaybe<Scalars["String"]["input"]>does the column match the given POSIX regular expression, case insensitive
+Optional
_is_Optional
_like?: InputMaybe<Scalars["String"]["input"]>does the column match the given pattern
+Optional
_lt?: InputMaybe<Scalars["String"]["input"]>Optional
_lte?: InputMaybe<Scalars["String"]["input"]>Optional
_neq?: InputMaybe<Scalars["String"]["input"]>Optional
_nilike?: InputMaybe<Scalars["String"]["input"]>does the column NOT match the given case-insensitive pattern
+Optional
_nin?: InputMaybe<Scalars["String"]["input"][]>Optional
_niregex?: InputMaybe<Scalars["String"]["input"]>does the column NOT match the given POSIX regular expression, case insensitive
+Optional
_nlike?: InputMaybe<Scalars["String"]["input"]>does the column NOT match the given pattern
+Optional
_nregex?: InputMaybe<Scalars["String"]["input"]>does the column NOT match the given POSIX regular expression, case sensitive
+Optional
_nsimilar?: InputMaybe<Scalars["String"]["input"]>does the column NOT match the given SQL regular expression
+Optional
_regex?: InputMaybe<Scalars["String"]["input"]>does the column match the given POSIX regular expression, case sensitive
+Optional
_similar?: InputMaybe<Scalars["String"]["input"]>does the column match the given SQL regular expression
+Boolean expression to filter rows from the table "table_items". All fields are combined with a logical 'AND'.
+Boolean expression to filter rows from the table "table_metadatas". All fields are combined with a logical 'AND'.
+Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'.
+Const
Const
The default gas currency for the network.
+Const
Const
Aptos derive path is 637
+Const
The default max gas amount when none is given.
+This is the maximum number of gas units that will be used by a transaction before being rejected.
+Note that max gas amount varies based on the transaction. A larger transaction will go over this +default gas amount, and the value will need to be changed for the specific transaction.
+Const
The default transaction expiration seconds from now.
+This time is how long until the blockchain nodes will reject the transaction.
+Note that the transaction expiration time varies based on network connection and network load. It may need to be +increased for the transaction to be processed.
+Const
The default number of seconds to wait for a transaction to be processed.
+This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for +the results of the transaction. It may take longer based on network connection and network load.
+Const
Const
Regular expression pattern for Firebase Auth issuer URLs +Matches URLs in the format: https://securetoken.google.com/[project-id] +where project-id can contain letters, numbers, hyphens, and underscores
+Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Const
Account implementation for the Keyless authentication scheme. This abstract class is used for standard Keyless Accounts +and Federated Keyless Accounts.
+