Abstract
Protected
constructorOptional
address?: AccountAddressOptional
proofReadonly
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.
+Private
Readonly
emitterAn event emitter used to assist in handling asynchronous proof fetching.
+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.
+Static
Readonly
PEPPER_This initializes the asyncronous proof fetch
+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
+Abstract
Interface for a generic Aptos account.
+The interface is defined as abstract class to provide a single entrypoint for account generation,
+either through Account.generate()
or Account.fromDerivationPath
.
+Despite this being 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.
+Readonly
Abstract
accountAccount address associated with the account
+Readonly
Abstract
publicPublic key associated with the account
+Abstract
signingSigning scheme used to sign transactions
+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.
+Static
authPublicKey - public key of the account
+The authentication key for the associated account
+use publicKey.authKey()
instead.
+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
Static
fromDerives an account with bip44 path and mnemonics
+Static
fromCreates an account from the provided private key.
+Static
fromStatic
generateDerives an account from a randomly generated private key.
+Optional
args: GenerateEd25519AccountArgsAn account compatible with the provided signature scheme
+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.
+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
ZEROReturn whether AccountAddresses are equal. AccountAddresses are considered equal +if their underlying byte data is identical.
+The AccountAddress to compare to.
+true if the AccountAddresses are equal, false if not.
+Returns whether an address is special, where special 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 if not.
+Serialize the AccountAddress to a Serializer instance's data buffer.
+The serializer to serialize the AccountAddress to.
+void
+const serializer = new Serializer();
const address = AccountAddress.fromString("0x1");
address.serialize(serializer);
const bytes = serializer.toUint8Array();
// `bytes` is now the BCS-serialized address.
+
+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.
+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.
+Return the AccountAddress as a string as per AIP-40. +https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
+In short, it means that special addresses are represented in SHORT form, meaning +0x0 through to 0xf inclusive, and every other address is represented in LONG form, +meaning 0x + 64 hex characters.
+AccountAddress as a string conforming to AIP-40.
+NOTE: Prefer to use toString
where possible.
Whereas toString will format special addresses (as defined by isSpecial) using the +SHORT form (no leading 0s), this format the address in the LONG format +unconditionally.
+This means it will be 0x + 64 hex characters.
+AccountAddress as a string in LONG form.
+NOTE: Prefer to use toString
where possible.
Whereas toString will format special addresses (as defined by isSpecial) using the +SHORT form (no leading 0s), this function will include leading zeroes. The string +will not have a leading zero.
+This means it will be 64 hex characters without a leading 0x.
+AccountAddress as a string in LONG form without a leading 0x.
+Static
deserializeDeserialize an AccountAddress from the byte buffer in a Deserializer instance.
+The deserializer to deserialize the AccountAddress from.
+An instance of AccountAddress.
+const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
const deserializer = new Deserializer(bytes);
const address = AccountAddress.deserialize(deserializer);
// `address` is now an instance of AccountAddress.
+
+Static
fromConvenience method for creating an AccountAddress from all known inputs.
+This handles, Uint8array, string, and AccountAddress itself
+Static
fromConvenience method for creating an AccountAddress from all known inputs.
+This handles, Uint8array, string, and AccountAddress itself
+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
is only provided for backwards compatibility.
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:
+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.
+An 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:
+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.
+An instance of AccountAddress.
+Static
isCheck if the string is a valid AccountAddress.
+A hex string representing an account address.
+Optional
strict?: booleanIf true, use strict parsing behavior. If false, use relaxed parsing behavior.
+valid = true if the string is valid, valid = false if not. If the string +is not valid, invalidReason will be set explaining why it is invalid.
+Abstract
Abstract
serializeStatic
deserializeTransaction authenticator Ed25519 for a multi signer transaction
+Account's Ed25519 public key.
+Account's Ed25519 signature
+Readonly
public_Readonly
signatureStatic
deserializeStatic
loadTransaction authenticator Multi Ed25519 for a multi signers transaction
+Account's MultiEd25519 public key.
+Account's MultiEd25519 signature
+Readonly
public_Readonly
signatureStatic
deserializeStatic
loadAccountAuthenticatorMultiKey for a multi signer
+MultiKey
+Signature
+Readonly
public_Readonly
signaturesStatic
deserializeStatic
loadAccountAuthenticatorSingleKey for a single signer
+AnyPublicKey
+AnySignature
+Readonly
public_Readonly
signatureStatic
deserializeStatic
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
toAbstract
verifyVerifies that the private key associated with this public key signed the message with the given signature.
+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 a 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
.
Readonly
publicReference to the inner public key
+Readonly
variantIndex of the underlying enum variant
+Get the authentication key associated with this public key
+Verifies that the private key associated with this public key signed the message with the given signature.
+Static
deserializeStatic
isStatic
isuse instanceof AnyPublicKey
instead.
Instance of signature that uses the SingleKey authentication scheme.
+This signature can only be generated by a SingleKeySigner
, since it uses the
+same authentication scheme.
Readonly
signaturePrivate
Readonly
variantIndex of the underlying enum variant
+Static
deserializeStatic
isThis class is the main entry point into Aptos's +APIs and separates functionality into different namespaces.
+To use the SDK, create a new Aptos instance to get access +to all the sdk functionality.
+const aptos = new Aptos();
+
+Optional
settings: AptosConfigReadonly
accountReadonly
ansReadonly
coinReadonly
configReadonly
digitalReadonly
eventReadonly
faucetReadonly
fungibleReadonly
generalReadonly
keylessReadonly
objectReadonly
stakingReadonly
tableReadonly
transactionAdd a digital asset property
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe 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 chain
+const transaction = await aptos.addDigitalAssetPropertyTransaction({
creator: alice,
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123",
});
+
+Add a typed digital asset property
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe 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 chain
+const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({
creator: alice,
propertyKey: "typedKey",
propertyType: "STRING",
propertyValue: "hello",
digitalAssetAddress: "0x123",
});
+
+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
+Prefer to use aptos.transaction.batch.forSingleAccount()
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 +dont rely on each other, i.e batch funds, batch token mints, etc.
+If any worker failure, the functions throws an error.
+Burn a digital asset by its creator
+The creator account
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.burnDigitalAssetTransaction({
creator: alice,
digitalAssetAddress: "0x123",
});
+
+Creates a new collection within the specified account
+A SimpleTransaction that when submitted will create the collection.
+const transaction = await aptos.createCollectionTransaction({
creator: alice,
description: "collectionDescription",
name: "collectionName",
uri: "collection-uri.com",
});
+
+Derives an account by providing a private key. +This functions 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 a ED25519 type, it looks up the authentication key on chain, and uses it to resolve +whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based +on that.
+An account private key
+Account type
+const account = await aptos.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey("0x123")})
+
+Derives the Keyless Account from the JWT token and corresponding EphemeralKeyPair. It will lookup the pepper from +the pepper service if not explicitly provided. It will compute the proof via the proving service. It will ch
+the EphemeralKeyPair used to generate the nonce in the JWT token
+JWT token
+Optional
pepper?: HexInputthe pepper
+Optional
proofa callback function that if set, the fetch of the proof will be done in the background. Once +fetching finishes the callback function will be called. This should be used to provide a more responsive user experience as now +they are not blocked on fetching the proof. Thus the function will return much more quickly.
+Optional
uida key in the JWT token to use to set the uidVal in the IdCommitment
+A KeylessAccount that can be used to sign transactions
+Derives the Keyless Account from the JWT token and corresponding EphemeralKeyPair. It will lookup the pepper from +the pepper service if not explicitly provided. It will compute the proof via the proving service. It will ch
+the EphemeralKeyPair used to generate the nonce in the JWT token
+the where the JWKs used to verify signatures are found. Setting the value derives a FederatedKeylessAccount
+JWT token
+Optional
pepper?: HexInputthe pepper
+Optional
proofa callback function that if set, the fetch of the proof will be done in the background. Once +fetching finishes the callback function will be called. This should be used to provide a more responsive user experience as now +they are not blocked on fetching the proof. Thus the function will return much more quickly.
+Optional
uida key in the JWT token to use to set the uidVal in the IdCommitment
+A KeylessAccount that can be used to sign transactions
+Freeze digital asset transfer ability
+The creator account
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.freezeDigitalAssetTransaferTransaction({
creator: alice,
digitalAssetAddress: "0x123",
});
+
+This creates an account if it does not exist and mints the specified amount of +coins into that account
+Address of the account to fund
+Amount of tokens to fund the account with
+Optional
options?: WaitForTransactionOptionsConfiguration options for waitForTransaction
+Transaction hash of the transaction that funded the account
+const transaction = await aptos.fundAccount({accountAddress:"0x123", amount: 100})
+
+Queries the account's APT amount
+The account address we want to get the total count for
+Optional
minimumOptional ledger version to sync up to, before querying
+Current amount of account's APT
+const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:"0x123"})
+
+Queries the account's coin amount by the coin type
+The account address we want to get the total count for
+Optional
coinThe coin type to query. + Note: faMetadataAddress will automatically fill this in if not provided when migrated to fungible assets
+Optional
faThe fungible asset metadata address to query. + Note: coinType will automatically fill this in if not provided when migrated to fungible assets
+Optional
minimumOptional ledger version to sync up to, before querying
+Current amount of account's coin
+const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:"0x123", coinType:"0x1::aptos_coin::AptosCoin"})
+
+Queries the current count of an account's coins aggregated
+The account address we want to get the total count for
+Optional
minimumOptional ledger version to sync up to, before querying
+Current count of the aggregated count of all account's coins
+const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:"0x123"})
+
+Queries an account's coins data
+The account address we want to get the coins data for
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ Array with the coins data
+const accountCoinsData = await aptos.getAccountCoinsData({accountAddress:"0x123"})
+
+Queries for all collections that an account currently has tokens for.
+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 param
+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
+const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:"0x123"})
+
+Fetches all top level domain names for an account
+a promise of an array of ANSName
+Get events by creation number and an account address
+The account address
+The event creation number
+Optional
minimumOptional ledger version to sync up to, before querying
+Promise
const events = await aptos.getAccountEventsByCreationNumber({accountAddress:"0x123",creationNumber: 0})
+
+Get events by event type and an account address
+The account address
+The event type
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ Promise
const events = await aptos.getAccountEventsByEventType({accountAddress:"0x123",eventType: "0x1::transaction_fee::FeeStatement"})
+
+Queries the current state for an Aptos account given its account address
+Aptos account address
+The account data
+{
sequence_number: "1",
authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69"
}
+
+Queries for a specific account module given account address and module name
+Aptos account address
+The name of the module
+Optional
options?: LedgerVersionArgAccount module
+const module = await aptos.getAccountModule({accountAddress:"0x456"}) +// An example of an account module response
+{
bytecode: "0xa11ceb0b0600000006010002030206050807070f0d081c200",
abi: { address: "0x1" }
}
+
+Queries for all modules in an account given an account address
+Note: In order to get all account modules, this function may call the API +multiple times as it auto paginates.
+Aptos account address
+Optional
options?: PaginationArgs & LedgerVersionArgAccount modules
+Fetches all names for an account (both top level domains and subdomains)
+a promise of an array of ANSName
+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
+const accountOwnedObjects = await aptos.getAccountOwnedObjects({accountAddress:"0x123"})
+
+Queries the account's current owned tokens.
+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 param
+The account address we want to get the tokens for
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: TokenStandardArg & PaginationArgs & OrderByArg<{ Tokens array with the token data
+const accountOwnedTokens = await aptos.getAccountOwnedTokens({accountAddress:"0x456"})
+
+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 param
+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
+const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({accountAddress:"0x123", collectionAddress:"0x456"})
+
+Queries a specific account resource given account address and resource type. Note that the default is any
in order
+to allow for ease of accessing properties of the object.
Aptos account address
+Optional
options?: LedgerVersionArgString representation of an on-chain Move struct type, i.e "0x1::aptos_coin::AptosCoin"
+Account resource
+const resource = await aptos.getAccountResource({accountAddress:"0x456"})
+
+Queries all account resources given an account address
+Note: In order to get all account resources, this function may call the API +multiple times as it auto paginates.
+Aptos account address
+Optional
options?: PaginationArgs & LedgerVersionArgAccount resources
+const resources = await aptos.getAccountResources({accountAddress:"0x456"})
+
+Fetches all subdomains names for an account
+a promise of an array of ANSName
+Queries the current count of tokens owned by an account
+The account address
+Optional
minimumOptional ledger version to sync up to, before querying
+Current count of tokens owned by the account
+const tokensCount = await aptos.getAccountTokensCount({accountAddress:"0x456"})
+
+Queries account transactions given an account address
+Note: In order to get all account transactions, this function may call the API +multiple times as it auto paginates.
+Aptos account address
+Optional
options?: PaginationArgsThe account transactions
+const transactions = await aptos.getAccountTransactions({accountAddress:"0x456"})
+
+Queries the current count of transactions submitted by an account
+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
+const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:"0x123"})
+
+Queries top user transactions
+The number of transactions to return
+GetChainTopUserTransactionsResponse
+const topUserTransactions = await aptos.getChainTopUserTransactions({limit:5})
+
+the name of the collection
+the address of the collection's creator
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: TokenStandardArgGetCollectionDataResponse response type
+use getCollectionDataByCreatorAddressAndCollectionName - this function +will be removed in the next major release
+Queries data of a specific collection by the collection creator address and the collection name.
+If, for some reason, a creator account has 2 collections with the same name in v1 and v2,
+can pass an optional tokenStandard
parameter to query a specific standard
const collection = await aptos.getCollectionData({creatorAddress:"0x123",collectionName:"myCollection"})
+
+Queries data of a specific collection by the collection ID.
+the ID of the collection, it's the same thing as the address of the collection object
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse response type
+const collection = await aptos.getCollectionDataByCollectionId({collectionId:"0x123"})
+
+Queries data of a specific collection by the collection creator address and the collection name.
+If, for some reason, a creator account has 2 collections with the same name in v1 and v2,
+can pass an optional tokenStandard
parameter to query a specific standard
the address of the collection's creator
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: TokenStandardArg & PaginationArgsGetCollectionDataResponse response type
+const collection = await aptos.getCollectionDataByCreatorAddressAnd({creatorAddress:"0x123"})
+
+Queries data of a specific collection by the collection creator address and the collection name.
+If, for some reason, a creator account has 2 collections with the same name in v1 and v2,
+can pass an optional 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 response type
+const collection = await aptos.getCollectionDataByCreatorAddressAndCollectionName({
creatorAddress:"0x123",
collectionName:"myCollection"
})
+
+Queries a collection's ID.
+This is the same as the collection's object address in V2, but V1 does +not use objects, and does not have 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
+const collection = await aptos.getCollectionId({creatorAddress:"0x123",collectionName:"myCollection"})
+
+Gets digital asset ownership data given the address of a digital asset.
+Optional
minimumOptional ledger version to sync up to, before querying
+GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.
+const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({digitalAssetAddress:"0x123"})
+
+Queries all fungible asset balances
+Optional
args: { 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
+const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances()
+
+Queries delegated staking activities
+Delegator address
+Optional
minimumOptional ledger version to sync up to, before querying
+Pool address
+GetDelegatedStakingActivitiesResponse response type
+const delegators = await aptos.getDelegatedStakingActivities({delegatorAddress:"0x123",poolAddress:"0x456"})
+
+Gets the activity data given the address of a digital asset.
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ GetTokenActivityResponse containing relevant activity data to the digital asset.
+const digitalAssetActivity = await aptos.getDigitalAssetActivity({digitalAssetAddress:"0x123"})
+
+Gets digital asset data given the address of a digital asset.
+Optional
minimumOptional ledger version to sync up to, before querying
+GetTokenDataResponse containing relevant data to the digital asset.
+const digitalAsset = await aptos.getDigitalAssetData({digitalAssetAddress:"0x123"})
+
+Fetches all subdomains names for a given domain. Note, this will not return the domain itself.
+a promise of an array of ANSName
+Get all events
+An optional where
can be passed in to filter out the response.
Optional
args: { Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ GetEventsQuery response type
+const events = await aptos.getEvents()
// with filtering
const events = await aptos.getEvents({options: { where: { account_address: { _eq: "0x123" } } }});
+
+Retrieve the expiration time of a domain name or subdomain name from the contract.
+A string of the name to retrieve
+number as a unix timestamp in milliseconds.
+// Will return the expiration of "test.aptos.apt" or undefined
const exp = await aptos.getExpiration({name: "test.aptos"})
// new Date(exp) would give you the date in question: 2021-01-01T00:00:00.000Z
+
+Queries all fungible asset activities
+Optional
args: { 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
+const fungibleAssetActivities = await aptos.getFungibleAssetActivities()
+
+Queries all fungible asset metadata.
+Optional
args: { 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
+const fungibleAsset = await aptos.getFungibleAssetMetadata()
+
+Queries a fungible asset metadata by the asset type
+This query returns the fungible asset metadata for a specific fungible asset.
+The asset type of the fungible asset. +e.g +"0x1::aptos_coin::AptosCoin" for Aptos Coin +"0xc2948283c2ce03aafbb294821de7ee684b06116bb378ab614fa2de07a99355a8" - address format if this is fungible asset
+Optional
minimumOptional ledger version to sync up to, before querying
+A fungible asset metadata item
+const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({assetType:"0x123::test_coin::TestCoin"})
+
+Queries a fungible asset metadata by the creator address
+This query returns the fungible asset metadata for a specific fungible asset.
+The creator address of the fungible asset.
+Optional
minimumOptional ledger version to sync up to, before querying
+A fungible asset metadata item
+const fungibleAsset = await aptos.getFungibleAssetMetadataByCreatorAddress({creatorAddress:"0x123"})
+
+Gives an estimate of the gas unit price required to get a +transaction on chain in a reasonable amount of time. +For more information https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price
+Object holding the outputs of the estimate gas API
+const gasPrice = await aptos.waitForTransaction()
+
+Queries for the Aptos ledger info
+Aptos Ledger Info
+const ledgerInfo = await aptos.getLedgerInfo() +// an example of the returned data
+{
"chain_id": 4,
"epoch": "8",
"ledger_version": "714",
"oldest_ledger_version": "0",
"ledger_timestamp": "1694695496521775",
"node_role": "validator",
"oldest_block_height": "0",
"block_height": "359",
"git_hash": "c82193f36f4e185fed9f68c4ad21f6c6dd390c6e"
}
+
+Get module events by event type
+The event type
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ Promise
const events = await aptos.getModuleEventsByEventType({eventType:"0x1::transaction_fee::FeeStatement"})
+
+Fetches a single name from the indexer
+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. +Can be a subdomain.
+A promise of an ANSName or undefined
+Queries current number of delegators in a pool. Throws an error if the pool is not found.
+Optional
minimumOptional ledger version to sync up to, before querying
+Pool address
+The number of delegators for the given pool
+const delegators = await aptos.getNumberOfDelegators({poolAddress:"0x123"})
+
+Queries current number of delegators in a pool. Throws an error if the pool is not found.
+Optional
args: { Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: OrderByArg<{ GetNumberOfDelegatorsForAllPoolsResponse response type
+const delegators = await aptos.getNumberOfDelegatorsForAllPools()
+
+Fetch the object data based on the oabject address
+Optional
minimumThe object address
+Optional
options?: PaginationArgs & OrderByArg<{ Configuration options for waitForTransaction
+The object data
+const object = await aptos.getObjectDataByObjectAddress({objectAddress:"0x123"})
+
+Gets the digital assets that the given address owns.
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: PaginationArgs & OrderByArg<{ The address of the owner
+GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddresss.
+const digitalAssets = await aptos.getOwnedDigitalAssets({ownerAddress:"0x123"})
+
+Retrieve the owner address of a domain name or subdomain name from the contract.
+A string of the name to retrieve
+AccountAddress if the name is owned, undefined otherwise
+// Will return the owner address of "test.aptos.apt" or undefined
const owner = await aptos.getOwnerAddress({name: "test.aptos"})
// owner = 0x123...
+
+Fetches the pepper from the Aptos pepper service API.
+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.
+Retrieve the primary name for an account. An account can have +multiple names that target it, but only a single name that is primary. An +account also may not have a primary name.
+A AccountAddressInput (address) of the account
+a string if the account has a primary name, undefined otherwise
+const name = await aptos.getPrimaryName({address: alice.accountAddress})
// name = test.aptos
+
+Query the processor status for a specific processor type.
+The processor type to query
+const status = await aptos.getProcessorStatus({processorType:"account_transactions_processor"})
+
+Fetches a proof from the Aptos prover service API.
+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.
+Returns a signing message for a transaction.
+This allows a user to sign a transaction using their own preferred signing method, and +then submit it to the network.
+A raw transaction for signing elsewhere
+const transaction = await aptos.transaction.build.simple({...})
const message = await aptos.getSigningMessage({transaction})
+
+Queries for a table item for a table identified by the handle and the key for the item. +Key and value types need to be passed in to help with key serialization and value deserialization.
+Note, this query calls the fullnode server
+Object that describes table item
+A pointer to where that table is stored
+Optional
options?: LedgerVersionArgTable item value rendered in JSON
+https://api.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E
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
},
})
+
+Queries for a table items data.
+Optional options.where
param can be passed to filter the response.
Note, this query calls the indexer server
+Optional
minimumOptional
options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<{ GetTableItemsDataResponse
+const data = await aptos.getTableItemsData({
options: { where: {
table_handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" },
transaction_version: { _eq: "0" }
}
},
});
+
+Queries for a table items metadata.
+Optional options.where
param can be passed to filter the response.
Note, this query calls the indexer server
+Optional
minimumOptional
options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<{ GetTableItemsMetadataResponse
+const data = await aptos.getTableItemsMetadata({
options: { where: { handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" } } },
});
+
+Retrieve the target address of a domain or subdomain name. This is the +address the name points to for use on chain. Note, the target address can +point to addresses that are not the owner of the name
+A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.
+AccountAddress if the name has a target, undefined otherwise
+const targetAddr = await aptos.getTargetAddress({name: "test.aptos"})
// targetAddr = 0x123...
+
+Queries on-chain transaction by transaction hash. This function will return pending transactions.
+Transaction from mempool (pending) or on-chain (committed) transaction
+const transaction = await aptos.getTransactionByHash({transactionHash:"0x123"})
+
+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.
+const transaction = await aptos.getTransactions({ledgerVersion:1})
+
+Queries on-chain transactions. This function will not return pending
+transactions. For that, use getTransactionsByHash
.
Optional
args: { Optional
options?: PaginationArgsArray of on-chain transactions
+const transactions = await aptos.getTransactions()
+
+Defines if specified transaction is currently in pending state
+To create a transaction hash:
+true
if transaction is in pending state and false
otherwise
const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:"0x123"})
+
+Looks up the account address for a given authentication key
+This handles both if the account's authentication key has been rotated or not.
+The authentication key
+Optional
minimumOptional ledger version to sync up to, before querying
+Optional
options?: LedgerVersionArgPromise
const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})
+
+Create a transaction to mint a digital asset into the creators account within an existing collection.
+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
propertyOptional
propertyOptional
propertythe URI to additional info about the digital asset
+A SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.mintDigitalAssetTransaction({
creator: alice,
description: "collectionDescription",
collection: "collectionName",
name: "digitalAssetName",
uri: "digital-asset-uri.com",
});
+
+Mint a soul bound digital asset into a recipient's account
+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?: InputGenerateTransactionOptionsOptional
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 chain
+const transaction = await aptos.mintSoulBoundTransaction({
account: alice,
collection: "collectionName",
description: "collectionDescription",
name: "digitalAssetName",
uri: "digital-asset-uri.com",
recipient: "0x123"
});
+
+Generates a transaction to publish a move package to chain.
+To get the metadataBytes
and byteCode
, can compile using Aptos CLI with command
+aptos move compile --save-metadata ...
,
+For more info https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module
The publisher account
+The package metadata bytes
+An array of the bytecode of each module in the package in compiler output order
+Optional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.publishPackageTransaction({
account: alice,
metadataBytes,
moduleBytecode: [byteCode],
})
+
+A generic function for retrieving data from Aptos Indexer. +For more detailed queries specification see +https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql
+The provided T type
+const topUserTransactions = await aptos.queryIndexer({
query: `query MyQuery {
ledger_infos {
chain_id
}}`;
})
+
+Registers a new name
+SimpleTransaction
+// An example of registering a subdomain name assuming def.apt is already registered
// and belongs to the sender alice.
const txn = aptos.registerName({
sender: alice,
name: "test.aptos.apt",
expiration: {
policy: "subdomain:independent",
expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000,
},
});
+
+Remove a digital asset property
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe 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 chain
+const transaction = await aptos.removeDigitalAssetPropertyTransaction({
creator: alice,
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: true,
digitalAssetAddress: "0x123",
});
+
+Renews a domain name
+Note: If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.
+A string of the domain the subdomain will be under. The signer must be the domain owner. +Subdomains cannot be renewed.
+Optional
options?: InputGenerateTransactionOptionsThe sender account
+Optional
years?: 1The number of years to renew the name. Currently only one year is permitted.
+SimpleTransaction
+await aptos.renewDomain({sender: alice, name: "test"})
// test.apt will be renewed for one year
+
+Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for +the account. +Note: Only legacy Ed25519 scheme is supported for now. +More info: https://aptos.dev/guides/account-management/key-rotation/
+The account to rotate the auth key for
+The new private key to rotate to
+PendingTransactionResponse
+const response = await aptos.rotateAuthKey({
fromAccount: alice,
toNewPrivateKey: new ED25519PublicKey("0x123"),
})
+
+Set the digital asset description
+The creator account
+The digital asset description
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.setDigitalAssetDescriptionTransaction({
creator: alice,
description: "digitalAssetDescription",
digitalAssetAddress: "0x123",
});
+
+Set the digital asset name
+The creator account
+The digital asset address
+Optional
digitalThe digital asset name
+Optional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.setDigitalAssetNameTransaction({
creator: alice,
name: "digitalAssetName",
digitalAssetAddress: "0x123",
});
+
+Set the digital asset name
+The creator account
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe digital asset uri
+A SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.setDigitalAssetURITransaction({
creator: alice,
uri: "digital-asset-uri.com",
digitalAssetAddress: "0x123",
});
+
+Sets the primary name for the sender. An account can have +multiple names that target it, but only a single name that is primary. An +account also may not have a primary name.
+Optional
name?: stringA string of the name: test, test.apt, test.aptos, test.aptos.apt, etc.
+Optional
options?: InputGenerateTransactionOptionsThe sender account
+SimpleTransaction
+await aptos.setPrimaryName({sender: alice, name: "test.aptos"})
const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})
// primaryName = test.aptos
+
+Sets the target address of a domain or subdomain name. This is the +address the name points to for use on chain. Note, the target address can +point to addresses that are not the owner of the name
+A AccountAddressInput of the address to set the domain or subdomain to
+A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc.
+Optional
options?: InputGenerateTransactionOptionsSimpleTransaction
+await aptos.setTargetAddress({sender: alice, name: "test.aptos", address: bob.accountAddress})
const address = await aptos.getTargetAddress({name: "test.aptos"})
// address = bob.accountAddress
+
+Sign a transaction that can later be submitted to chain
+The signer account
+A raw transaction to sign on
+AccountAuthenticator
+const transaction = await aptos.transaction.build.simple({...})
const transaction = await aptos.transaction.sign({
signer: alice,
transaction
})
+
+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 chain
+PendingTransactionResponse
+const transaction = await aptos.transaction.build.simple({...})
const transaction = await aptos.signAndSubmitTransaction({
signer: alice,
transaction
})
+
+Sign a transaction as a fee payer that can later be submitted to chain
+The fee payer signer account
+A raw transaction to sign on
+AccountAuthenticator
+const transaction = await aptos.transaction.build.simple({...})
const transaction = await aptos.transaction.signAsFeePayer({
signer: alice,
transaction
})
+
+Generate a transfer coin transaction that can be simulated and/or signed and submitted
+The amount to transfer
+Optional
coinoptional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin
+Optional
options?: InputGenerateTransactionOptionsThe recipient address
+The sender account
+SimpleTransaction
+const transferCoinTransaction = await aptos.transferCoinTransaction({
sender: "0x123",
recipient:"0x456",
amount: 10,
})
+
+Transfer a digital asset (non fungible digital asset) ownership.
+We can transfer a digital asset only when the digital asset is not frozen +(i.e. owner transfer is not disabled such as for soul bound digital assets)
+The digital asset address
+Optional
digitaloptional. The digital asset type, default to "0x4::token::Token"
+Optional
options?: InputGenerateTransactionOptionsThe recipient account address
+The sender account of the current digital asset owner
+A SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.transferDigitalAssetTransaction({
sender: alice,
digitalAssetAddress: "0x123",
recipient: "0x456",
});
+
+Transfer amount
of fungible asset from sender's primary store to recipient's primary store.
Use this method to transfer any fungible asset including fungible token.
+Optional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain.
+const transaction = await aptos.transferFungibleAsset({
sender: alice,
fungibleAssetMetadataAddress: "0x123",
recipient: "0x456",
amount: 5
})
+
+Unfreeze digital asset transfer ability
+The creator account
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsA SimpleTransaction that can be simulated or submitted to chain
+const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({
creator: alice,
digitalAssetAddress: "0x123",
});
+
+Update a digital asset property
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe 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 chain
+const transaction = await aptos.updateDigitalAssetPropertyTransaction({
creator: alice,
propertyKey: "newKey",
propertyType: "BOOLEAN",
propertyValue: false,
digitalAssetAddress: "0x123",
});
+
+Update a typed digital asset property
+The digital asset address
+Optional
digitalOptional
options?: InputGenerateTransactionOptionsThe 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 chain
+const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({
creator: alice,
propertyKey: "typedKey",
propertyType: "U8",
propertyValue: 2,
digitalAssetAddress: "0x123",
});
+
+This installs a set of FederatedJWKs at an address for a given iss.
+It will fetch the JWK set from the well-known endpoint and update the FederatedJWKs at the sender's address +to reflect it.
+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
+const data = await aptos.view({
payload: {
function: "0x1::coin::balance",
typeArguments: ["0x1::aptos_coin::AptosCoin"],
functionArguments: [accountAddress],
}
})
+
+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
+const data = await aptos.view({
payload: {
function: "0x1::coin::balance",
typeArguments: ["0x1::aptos_coin::AptosCoin"],
functionArguments: [accountAddress.toString()],
}
})
+
+Waits for a transaction to move past the pending state.
+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?: WaitForTransactionOptionsThe hash of a transaction previously submitted to the blockchain.
+The transaction on-chain. See above for more details.
+const transaction = await aptos.waitForTransaction({transactionHash:"0x123"})
+
+The type returned from an API error
+the error name "AptosApiError"
+the url the request was made to
+the response status. i.e. 400
+the response message
+the response data
+the AptosRequest
+Readonly
dataReadonly
requestOptional
stackReadonly
statusReadonly
statusReadonly
urlStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureThis class holds the config information for the SDK client instance.
+const aptosConfig = new AptosConfig({network:Network.TESTNET})
+
+Optional
settings: AptosSettingsReadonly
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
+Each account stores an authentication key. Authentication key enables account owners to rotate +their private key(s) associated with the account without changing the address that hosts their account.
+Readonly
dataThe raw bytes of the authentication key.
+Static
Readonly
LENGTHAn authentication key is always a SHA3-256 hash of data, and is always 32 bytes.
+The data to hash depends on the underlying public key type and the derivation scheme.
+Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes, +the AuthenticationKey bytes are directly translated to an AccountAddress.
+AccountAddress
+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(s) to an AuthenticationKey, using the derivation scheme inferred from the +instance of the PublicKey type passed in.
+AuthenticationKey
+Static
fromthe public key and scheme to use for the derivation
+Use fromPublicKey
instead
+Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.
This facilitates targeting a specific scheme for deriving an authentication key from a public key.
+Static
fromReadonly
valueSerialize 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.
+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
deserializeRepresentation of a ChainId that can serialized and deserialized
+Readonly
chainStatic
deserializePrivate
bufferPrivate
offsetHelper 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
+const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
// value is now an instance of MyClass
// equivalent to `const value = MyClass.deserialize(deserializer)`
+
+Deserializes a an optional deserializable class.
+BCS layout for Optional
The BCS-deserializable class to deserialize the buffered bytes into.
+the deserialized value of class type T
+const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function
// value is now an instance of MyClass
const deserializer = new Deserializer(new Uint8Array([0]));
const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function
// value is undefined
+
+Deserializes a an optional string.
+BCS layout for Optional
const deserializer = new Deserializer(new Uint8Array([0x00]));
assert(deserializer.deserializeOptionStr() === undefined);
const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
assert(deserializer.deserializeOptionStr() === "1234abcd");
+
+Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first, +and then reads "l" bytes of content. Decodes the byte array 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.
+const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
assert(deserializer.deserializeStr() === "1234abcd");
+
+Deserializes a uint64 number.
+BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
+const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
assert(deserializer.deserializeU64() === 1311768467750121216);
+
+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
+
+Private
readSigner implementation for the Ed25519 authentication scheme. +This extends an Ed25519Account by adding signing capabilities through an Ed25519PrivateKey.
+Note: Generating a signer instance does not create the account on-chain.
+Readonly
accountAccount address associated with the account
+Readonly
privatePrivate key associated with the account
+Readonly
publicPublic key associated with the account
+Readonly
signingSigning scheme used to sign transactions
+Sign the given message using the account's Ed25519 private key.
+in HexInput format
+Signature
+Sign the given transaction using the available signing capabilities.
+the transaction to be signed
+Signature
+Sign a transaction using the account's Ed25519 private key.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using the account's Ed25519 private key.
+the signing message, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Static
fromDerives an account with bip44 path and mnemonics
+Static
generateDerives a signer from a randomly generated private key
+Represents the private key of an Ed25519 key pair.
+Create a new PrivateKey instance from a Uint8Array or String.
+HexInput (string or Uint8Array)
+Private
Readonly
signingThe Ed25519 signing key
+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
+Derive the Ed25519PublicKey for this private key.
+Ed25519PublicKey
+Sign the given message with the private key.
+a message as a string or Uint8Array
+Signature
+Static
deserializeStatic
fromDerives a private key from a mnemonic seed phrase.
+To derive multiple keys from the same phrase, change the path
+IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism, +so non-hardened derivation cannot work)
+the BIP44 path
+the mnemonic seed phrase
+Static
Private
fromA private inner function so we can separate from the main fromDerivationPath() method +to add tests to verify we create the keys correctly.
+the BIP44 path
+the seed phrase created by the mnemonics
+the offset used for key derivation, defaults to 0x80000000
+Static
generateGenerate a new random private key.
+Ed25519PrivateKey
+Static
isuse instanceof Ed25519PrivateKey
instead.
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
Create a new PublicKey instance from a Uint8Array or String.
+A HexInput (string or Uint8Array)
+Private
Readonly
keyBytes of the public key
+Static
Readonly
LENGTHLength of an Ed25519 public key
+Get the authentication key associated with this public key
+Verifies a signed data with a public key
+Static
deserializeStatic
isStatic
isuse instanceof Ed25519PublicKey
instead.
A signature of a message signed using an Ed25519 private key
+Private
Readonly
dataThe signature bytes
+Static
Readonly
LENGTHLength of an Ed25519 signature
+Static
deserializeRepresentation of a EntryFunction that can serialized and deserialized
+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.
+A coin transfer function has one type argument "CoinType".
+public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)
+
+A coin transfer function has three arguments "from", "to" and "amount".
+public entry fun transfer<CoinType>(from: &signer, to: address, amount: u64)
+
+Readonly
argsReadonly
function_Readonly
module_Readonly
type_Static
buildA helper function to build a EntryFunction payload from raw primitive values
+Fully qualified module name in format "AccountAddress::module_id" e.g. "0x1::coin"
+Function name
+Type arguments that 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: Attempting to use this class for a serialized script function will result in 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.
+Private
constructorReadonly
valueSerialize 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.
+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
+A container for a signature that is a ZeroKnowledgeSig. Can be expanded to support OpenIdSignature.
+Readonly
signaturePrivate
Readonly
variantIndex of the underlying enum variant
+Static
deserializeA class which contains a key pair that is used in signing transactions via the Keyless authentication scheme. This key pair +is ephemeral and has an expiration time. For more details on how this class is used - +https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui
+Optional
blinder?: HexInputOptional
expiryReadonly
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 comprises of a hash of the +ephermeral public key, expiry date, and blinder.
+Private
privateA private key used to sign transactions. This private key is not tied to any account on the chain as it +is ephemeral (not permanent) in nature.
+Private
publicA public key used to verify transactions. This public key is not tied to any account on the chain as it +is ephemeral (not permanent) in nature.
+Static
Readonly
BLINDER_Returns the public key of the key pair.
+EphemeralPublicKey
+Sign the given message with the private key.
+in HexInput format
+EphemeralSignature
+Static
deserializeStatic
fromStatic
generateReturns the public key of the key pair.
+boolean
+Represents ephemeral public keys for Aptos Keyless accounts.
+These are not public keys used as a public key on an account. They are only used ephemerally on Keyless accounts.
+Readonly
publicThe public key itself
+Readonly
variantAn enum indicating the scheme of the ephemeral public key
+Verifies a signed data with a the ephemeral public key
+message
+The signature that was signed by the private key of the ephemeral public key
+true if the signature is valid
+Static
deserializeStatic
isRepresents ephemeral signatures used in Aptos Keyless accounts.
+These signatures are used inside of KeylessSignature
+Readonly
signatureThe signature signed by the private key of an EphemeralKeyPair
+Static
deserializeStatic
fromAccount 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 JWT, proof, EphemeralKeyPair and the +address the 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.
+Private
constructorOptional
address?: AccountAddressOptional
proofReadonly
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.
+Static
Readonly
PEPPER_This initializes the asyncronous proof fetch
+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
createOptional
address?: AccountAddressOptional
proofOptional
uidStatic
deserializeStatic
fromRepresents the FederatedKeylessPublicKey public key
+These keys use an onchain address as a source of truth for the JWK used to verify signatures.
+FederatedKeylessPublicKey authentication key is represented in the SDK as AnyPublicKey
.
Readonly
jwkThe address that contains the JWK set to be used for verification.
+Readonly
keylessThe inner public key which contains the standard Keyless public key.
+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
isRepresentation of a Fee Payer Transaction that can serialized and deserialized
+Readonly
fee_The fee payer account address
+Readonly
raw_The raw transaction
+Readonly
secondary_The secondary signers on this transaction - optional and can be empty
+Serialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Static
loadThis class exists to represent a contiguous sequence of already serialized BCS-bytes.
+It 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.
+If you want to write your own serialization function and pass the bytes as a transaction argument, + you should use this class.
+ This class is also more generally used to represent type-agnostic BCS bytes as a vector
An example of this is the 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],
});
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.
+
+value: HexInput representing a sequence of Uint8 bytes
+a Serializable FixedBytes instance, which when serialized, does not prepend the length of the bytes
+EntryFunctionBytes
+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.
+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
deserializeA representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof.
+The bytes of G1 proof point a
+The bytes of G2 proof point b
+The bytes of G1 proof point c
+Static
deserializeNOTE: Do not use this class when working with account addresses, use AccountAddress.
+NOTE: When accepting hex data as input to a function, prefer to accept HexInput and +then use the static helper methods of this class to convert it into the desired +format. This enables the greatest flexibility for the developer.
+Hex is a helper class for working with hex data. Hex data, when represented as a +string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.
+You might use this class like this:
+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.
These are some other ways to chain the functions together:
+Hex.fromHexString({ hexInput: "0x1f" }).toUint8Array()
new Hex([1, 3]).toStringWithoutPrefix()
Private
Readonly
dataReturn whether Hex instances are equal. Hex instances are considered equal if +their underlying byte data is identical.
+The Hex instance to compare to.
+true if the Hex instances are equal, false if not.
+Static
fromStatic
fromStatic
isCheck if the string is valid hex.
+A hex string representing byte data.
+valid = true if the string is valid, false if not. If the string is not +valid, invalidReason and invalidReasonMessage will be set explaining why it is +invalid.
+Representation of an Identifier that can serialized and deserialized. +We use Identifier to represent the module "name" in "ModuleId" and +the "function name" in "EntryFunction"
+Static
deserializeAccount 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.
+Private
constructorOptional
address?: AccountAddressOptional
proofReadonly
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.
+Static
Readonly
PEPPER_This initializes the asyncronous proof fetch
+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
createOptional
address?: AccountAddressOptional
proofOptional
uidStatic
deserializeStatic
fromA class which represents the on-chain configuration for how Keyless accounts work
+Readonly
maxThe maximum lifespan of an ephemeral key pair. This is configured on chain.
+Readonly
verficationThe verification key used to verify Groth16 proofs on chain
+Static
createRepresents the KeylessPublicKey public key
+KeylessPublicKey authentication key is represented in the SDK as AnyPublicKey
.
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
Get the authentication key for the keyless public key
+AuthenticationKey
+Verifies a signed data with a public key
+message
+The signature
+true if the signature is valid
+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
deserializeStatic
fromStatic
isStatic
isStatic
loadA signature of a message signed via Keyless Accounnt that uses proofs or the jwt token to authenticate.
+Readonly
ephemeralThe inner signature ZeroKnowledgeSigniature 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.
+Static
deserializeStatic
getStatic
isRepresentation of a ModuleId that can serialized and deserialized +ModuleId means the module address (e.g "0x1") and the module name (e.g "coin")
+Full name of a module.
+The account address. e.g "0x1"
+The module name under the "address". e.g "coin"
+Readonly
addressReadonly
nameStatic
deserializeStatic
fromOptional
value: null | TOptional
Readonly
valuePrivate
vecSerialize 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.
+Retrieves the inner value of the MoveOption.
+This method is inspired by Rust's Option<T>.unwrap()
.
+In Rust, attempting to unwrap a None
value results in a panic.
Similarly, this method will throw an error if the value is not present.
+The contained value if present.
+const option = new MoveOption<Bool>(new Bool(true));
const value = option.unwrap(); // Returns the Bool instance
+
+Throws an error if the MoveOption does not contain a value.
+Static
BoolFactory method to generate a MoveOptionboolean
or undefined
.
Optional
value: null | booleana MoveOptionvalue
MoveOption.Bool(true).isSome() === true;
MoveOption.Bool().isSome() === false;
MoveOption.Bool(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
MoveFactory method to generate a MoveOptionstring
or undefined
.
Optional
value: null | stringa MoveOptionvalue
MoveOption.MoveString("hello").isSome() === true;
MoveOption.MoveString("").isSome() === true;
MoveOption.MoveString().isSome() === false;
MoveOption.MoveString(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U128Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumbera MoveOptionvalue
MoveOption.U128(1).isSome() === true;
MoveOption.U128().isSome() === false;
MoveOption.U128(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U16Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numbera MoveOptionvalue
MoveOption.U16(1).isSome() === true;
MoveOption.U16().isSome() === false;
MoveOption.U16(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U256Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumbera MoveOptionvalue
MoveOption.U256(1).isSome() === true;
MoveOption.U256().isSome() === false;
MoveOption.U256(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U32Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numbera MoveOptionvalue
MoveOption.U32(1).isSome() === true;
MoveOption.U32().isSome() === false;
MoveOption.U32(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U64Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumbera MoveOptionvalue
MoveOption.U64(1).isSome() === true;
MoveOption.U64().isSome() === false;
MoveOption.U64(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
U8Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numbera MoveOptionvalue
MoveOption.U8(1).isSome() === true;
MoveOption.U8().isSome() === false;
MoveOption.U8(undefined).isSome() === false;
+
+value: the value used to fill the MoveOption. If value
is undefined
+the resulting MoveOption's .isSome() method will return false.
Static
deserializeSerialize 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.
+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"]);
+
+values: an Array
a MoveVector<T>
with the values values
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.
+NOTE: This function will only work when the inner values in the MoveVector
are U8
s.
Static
BoolFactory method to generate a MoveVector of Bools from an array of booleans.
+a MoveVector<Bool>
const v = MoveVector.Bool([true, false, true, false]);
+
+values: an array of bools
to convert to Bools
Static
MoveFactory method to generate a MoveVector of MoveStrings from an array of strings.
+a MoveVector<MoveString>
const v = MoveVector.MoveString(["hello", "world"]);
+
+values: an array of strings
to convert to MoveStrings
Static
U128Factory method to generate a MoveVector of U128s from an array of numbers or bigints.
+a MoveVector<U128>
const v = MoveVector.U128([1, 2, 3, 4]);
+
+values: an array of numbers of type number | bigint
to convert to U128s
Static
U16Factory method to generate a MoveVector of U16s from an array of numbers.
+a MoveVector<U16>
const v = MoveVector.U16([1, 2, 3, 4]);
+
+values: an array of numbers
to convert to U16s
Static
U256Factory method to generate a MoveVector of U256s from an array of numbers or bigints.
+a MoveVector<U256>
const v = MoveVector.U256([1, 2, 3, 4]);
+
+values: an array of numbers of type number | bigint
to convert to U256s
Static
U32Factory method to generate a MoveVector of U32s from an array of numbers.
+a MoveVector<U32>
const v = MoveVector.U32([1, 2, 3, 4]);
+
+values: an array of numbers
to convert to U32s
Static
U64Factory method to generate a MoveVector of U64s from an array of numbers or bigints.
+a MoveVector<U64>
const v = MoveVector.U64([1, 2, 3, 4]);
+
+values: an array of numbers of type number | bigint
to convert to U64s
Static
U8Factory method to generate a MoveVector of U8s from an array of numbers.
+a MoveVector<U8>
const v = MoveVector.U8([1, 2, 3, 4]);
+
+values: an array of numbers
to convert to U8s
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.
+a MoveVector of the corresponding class T +*
+const vec = MoveVector.deserialize(deserializer, U64);
+
+deserializer: the Deserializer instance to use, with bytes loaded into it already. +cls: the class to typecast the input values to, must be a Serializable and Deserializable type.
+Representation of a Multi Agent Transaction that can serialized and deserialized
+Readonly
raw_The raw transaction
+Readonly
secondary_The secondary signers on this transaction
+Serialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Static
loadRepresentation of a Raw Transaction that can serialized and deserialized
+SimpleTransaction represents a simple transaction type of a single signer that +can be submitted to Aptos chain for execution.
+SimpleTransaction metadata contains the Raw Transaction and an optional +sponsor Account Address to pay the gas fees.
+The Raw Tranasaction
+Optional
feePayerAddress: AccountAddressThe sponsor Account Address
+Optional
feeStatic
deserializeRepresents the public key of a K-of-N Ed25519 multi-sig transaction.
+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 list of public keys
+At least "threshold" signatures must be valid
+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
+Get the authentication key associated with this public key
+Verifies that the private key associated with this public key signed the message with the given signature.
+Static
deserializeRepresents 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
+Readonly
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
+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
+Here's an example of valid bits
[0, 2, 31]
+
+[0, 2, 31]
means the 1st, 3rd and 32nd bits should be set in the bitmap.
+The result bitmap should be 0b1010000000000000000000000000001
Static
deserializeRepresents the public key of a multi-agent account.
+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.
Readonly
publicList of any public keys
+Readonly
signaturesThe minimum number of valid signatures required, for the number of public keys specified
+Get the authentication key associated with this public key
+Get the index of the provided public key.
+array of the index mapping to the matching public keys
+the corresponding index of the publicKey, if it exists
+Verifies that the private key associated with this public key signed the message with the given signature.
+Static
deserializeSigner implementation for the MultiKey authentication scheme.
+This accounts to use a M of N signing scheme. M and N are specified in the MultiKey +It signs messages via the array of M number of Accounts that individually correspond to a public key in the MultiKey.
+Note: Generating a signer instance does not create the account on-chain.
+constructor for MultiKeyAccount
+Optional
address?: AccountAddressInputthe multikey of the account which consists of N public keys and a number M which is +the number of required signatures.
+an array of M signers that will be used to sign the transaction
+MultiKeyAccount
+Readonly
accountAccount address associated with the account
+Readonly
publicPublic key associated with the account
+Readonly
signaturesReadonly
signerAn array of indicies 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
+Sign the given message using the MultiKeyAccount's signers
+MultiKeySignature
+Sign the given transaction using the MultiKeyAccount's signers
+the transaction to be signed
+MultiKeySignature
+Sign a transaction using the account's signers.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using the account's signers.
+the signing message, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Static
fromStatic constructor for MultiKeyAccount
+MultiKeyAccount
+Static
isAn abstract representation of a crypto signature, +associated to a specific signature scheme e.g. Ed25519 or Secp256k1
+This is the product of signing a message directly from a PrivateKey +and can be verified against a CryptoPublicKey.
+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
+Readonly
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
+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
+Here's an example of valid bits
[0, 2, 31]
+
+[0, 2, 31]
means the 1st, 3rd and 32nd bits should be set in the bitmap.
+The result bitmap should be 0b1010000000000000000000000000001
Static
deserializeRepresentation of a MultiSig that can serialized and deserialized
+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.
+Readonly
multisig_Optional
Readonly
transaction_Static
deserializeRepresentation of a MultiSig Transaction Payload from multisig_account.move
+that can be serialized and deserialized
This class exists right now to represent an extensible transaction payload class for
+transactions used in multisig_account.move
. Eventually, this class will be able to
+support script payloads when the multisig_account.move
module supports them.
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.
+Readonly
transaction_Static
deserializeThis error is used to explain why parsing failed.
+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
captureAbstract
An abstract representation of a public key.
+Provides a common interface for verifying any signature.
+Abstract
serializeAbstract
toAbstract
verifyVerifies that the private key associated with this public key signed the message with the given signature.
+Representation of a Raw Transaction that can serialized and deserialized
+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.
+Readonly
chain_Readonly
expiration_Readonly
gas_Readonly
max_Readonly
payloadReadonly
senderReadonly
sequence_Static
deserializeAbstract
Representation of a Raw Transaction With Data that can serialized and deserialized
+Abstract
serializeSerialize a Raw Transaction With Data
+Static
deserializeDeserialize a Raw Transaction With Data
+Representation of the challenge which is needed to sign by owner of the account +to rotate the authentication key.
+Readonly
accountReadonly
currentReadonly
moduleReadonly
newReadonly
originatorReadonly
sequenceReadonly
structRepresentation of a Script that can serialized and deserialized
+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.
+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,)
+
+Readonly
argsThe arguments that the bytecode function requires.
+Readonly
bytecodeThe move module bytecode
+Readonly
type_The type arguments that the bytecode function requires.
+Static
deserializeA Secp256k1 ecdsa private key
+Create a new PrivateKey instance from a Uint8Array or String.
+A HexInput (string or Uint8Array)
+Private
Readonly
keyThe private key bytes
+Static
Readonly
LENGTHLength of Secp256k1 ecdsa private key
+Derive the Secp256k1PublicKey from this private key.
+Secp256k1PublicKey
+Sign the given message with the private key.
+Note: signatures are canonical, and non-malleable
+a message as a string or Uint8Array
+Signature
+Static
deserializeStatic
fromDerives a private key from a mnemonic seed phrase.
+the BIP44 path
+the mnemonic seed phrase
+The generated key
+Static
Private
fromA private inner function so we can separate from the main fromDerivationPath() method +to add tests to verify we create the keys correctly.
+the BIP44 path
+the seed phrase created by the mnemonics
+The generated key
+Static
generateGenerate a new random private key.
+Secp256k1PrivateKey
+Static
isuse instanceof Secp256k1PrivateKey
instead
Represents the Secp256k1 ecdsa public key
+Secp256k1 authentication key is represented in the SDK as AnyPublicKey
.
Create a new PublicKey instance from a Uint8Array or String.
+A HexInput (string or Uint8Array)
+Private
Readonly
keyStatic
Readonly
LENGTHVerifies a Secp256k1 signature against the public key
+Note signatures are validated to be canonical as a malleability check
+Static
deserializeStatic
isStatic
isuse instanceof Secp256k1PublicKey
instead
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)
+Private
Readonly
dataThe signature bytes
+Static
Readonly
LENGTHSecp256k1 ecdsa signatures are 256-bit.
+Static
deserializeAbstract
Abstract
serializeReadonly
valueSerialize 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.
+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
deserializePrivate
bufferPrivate
offsetProtected
appendPrivate
ensureSerializes a Serializable
value, facilitating composable serialization.
The Serializable value to serialize
+the serializer instance
+// Define the MoveStruct class that implements the Serializable interface
class MoveStruct extends Serializable {
constructor(
public creatorAddress: AccountAddress, // where AccountAddress extends Serializable
public collectionName: string,
public tokenName: string
) {}
serialize(serializer: Serializer): void {
serializer.serialize(this.creatorAddress); // Composable serialization of another Serializable object
serializer.serializeStr(this.collectionName);
serializer.serializeStr(this.tokenName);
}
}
// Construct a MoveStruct
const moveStruct = new MoveStruct(new AccountAddress(...), "MyCollection", "TokenA");
// Serialize a string, a u64 number, and a MoveStruct instance.
const serializer = new Serializer();
serializer.serializeStr("ExampleString");
serializer.serializeU64(12345678);
serializer.serialize(moveStruct);
// Get the bytes from the Serializer instance
const serializedBytes = serializer.toUint8Array();
+
+Serializes a BCS Serializable values into a serializer instance or undefined. +Note that this does not return anything. The bytes are added to the serializer instance's byte buffer.
+Optional
value: Tconst serializer = new Serializer();
serializer.serializeOption(new AccountAddress(...));
const serializedBytes = serializer.toUint8Array();
// serializedBytes is now the BCS-serialized byte representation of AccountAddress
const serializer = new Serializer();
serializer.serializeOption(undefined);
assert(serializer.toUint8Array() === new Uint8Array([0x00]));
+
+Serializes an optional string. UTF8 string is supported.
+The existence of the string is encoded first, 0 if undefined and 1 if it exists. +Them the number of bytes in the string content is serialized, as a uleb128-encoded u32 integer. +Then the string content is serialized as UTF8 encoded bytes.
+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
+Optional
value: stringconst serializer = new Serializer();
serializer.serializeOptionStr("1234abcd");
assert(serializer.toUint8Array() === new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
const serializer = new Serializer();
serializer.serializeOptionStr(undefined);
assert(serializer.toUint8Array() === new Uint8Array([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.
+const serializer = new Serializer();
serializer.serializeStr("1234abcd");
assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
+
+Serializes a uint128 number.
+BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
+Serializes a uint16 number.
+BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
+const serializer = new Serializer();
serializer.serializeU16(4660);
assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12]));
+
+Serializes a uint256 number.
+BCS layout for "uint256": Sixteen bytes. Binary format in little-endian representation.
+Serializes a uint32 number.
+BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
+const serializer = new Serializer();
serializer.serializeU32(305419896);
assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12]));
+
+Serializes a uint64 number.
+BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
+const serializer = new Serializer();
serializer.serializeU64(1311768467750121216);
assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
+
+Serializes an array of BCS Serializable values to a serializer instance. +Note that this does not return anything. 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])`;
+
+Private
serializeAbstract
An abstract representation of a crypto signature, +associated to a specific signature scheme e.g. Ed25519 or Secp256k1
+This is the product of signing a message directly from a PrivateKey +and can be verified against a CryptoPublicKey.
+Abstract
serializeAbstract
toA SignedTransaction consists of a raw transaction and an authenticator. The authenticator +contains a client's public key and the signature of the raw transaction.
+Contains a client's public key and the signature of the raw transaction. +Authenticator has 3 flavors: single signature, multi-signature and multi-agent.
+Readonly
authenticatorReadonly
raw_Static
deserializeRepresentation of a SimpleTransaction that can serialized and deserialized
+SimpleTransaction represents a simple transaction type of a single signer that +can be submitted to Aptos chain for execution.
+SimpleTransaction metadata contains the Raw Transaction and an optional +sponsor Account Address to pay the gas fees.
+The Raw Tranasaction
+Optional
feePayerAddress: AccountAddressThe sponsor Account Address
+Optional
feeReadonly
secondaryStatic
deserializeSigner implementation for the SingleKey authentication scheme. +This 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.
+Readonly
accountAccount address associated with the account
+Readonly
privatePrivate key associated with the account
+Readonly
publicPublic key associated with the account
+Readonly
signingSigning scheme used to sign transactions
+Sign the given message using the account's private key.
+in HexInput format
+Signature
+Sign the given transaction using the account's private key.
+the transaction to be signed
+Signature
+Sign a transaction using the account's private key.
+the raw transaction
+the AccountAuthenticator containing the signature of the transaction, together with the account's public key
+Sign a message using the account's private key.
+the signing message, as binary input
+the AccountAuthenticator containing the signature, together with the account's public key
+Static
fromDerives an account with bip44 path and mnemonics, +Default to using an Ed25519 signature scheme.
+Static
generateDerives an account from a randomly generated private key. +Default generation is using an Ed25519 key
+Account with the given signature scheme
+Readonly
addressReadonly
moduleReadonly
nameReadonly
typeStatic
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: ZkProofReadonly
domainThe domain separator prefix used when hashing.
+Optional
proofThe zero knowledge proof used in signing the transaction.
+The transaction to sign.
+Abstract
Abstract
serializeStatic
deserializeTransaction authenticator Ed25519 for a single signer transaction
+Client's public key.
+Ed25519 signature of a raw transaction.
+Creating a Signed Transaction +for details about generating a signature.
+Readonly
public_Readonly
signatureStatic
deserializeStatic
loadTransaction authenticator for a fee payer transaction
+Sender account authenticator
+Secondary signers address
+Secondary signers account authenticators
+Object of the fee payer account address and the fee payer authentication
+Readonly
fee_Readonly
secondary_Readonly
secondary_Readonly
senderStatic
deserializeStatic
loadTransaction authenticator for a multi-agent transaction
+Sender account authenticator
+Secondary signers address
+Secondary signers account authenticators
+Readonly
secondary_Readonly
secondary_Readonly
senderStatic
deserializeStatic
loadTransaction authenticator Ed25519 for a multi signers transaction
+Client's public key.
+Multi Ed25519 signature of a raw transaction.
+Readonly
public_Readonly
signatureStatic
deserializeStatic
loadSingle Sender authenticator for a single signer transaction
+AccountAuthenticator
+Readonly
senderStatic
deserializeStatic
loadAbstract
Representation of the supported Transaction Payload +that can serialized and deserialized
+Abstract
serializeSerialize a Transaction Payload
+Static
deserializeDeserialize a Transaction Payload
+Representation of a Transaction Payload Entry Function that can serialized and deserialized
+Readonly
entrySerialize a Transaction Payload
+Static
deserializeDeserialize a Transaction Payload
+Static
loadRepresentation of a Transaction Payload Multi-sig that can serialized and deserialized
+Readonly
multiSerialize a Transaction Payload
+Static
deserializeDeserialize a Transaction Payload
+Static
loadRepresentation of a Transaction Payload Script that can serialized and deserialized
+Readonly
scriptSerialize a Transaction Payload
+Static
deserializeDeserialize a Transaction Payload
+Static
loadTransactionWorker 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
Provides a simple framework for receiving payloads to be processed.
+a config object
+the max wait time to wait before resyncing the sequence number +to the current on-chain state, default to 30
+submit up to maximumInFlight
transactions per account.
+Mempool limits the number of transactions per account to 100, hence why we default to 100.
If maximumInFlight
are in flight, wait sleepTime
seconds before re-evaluating, default to 10
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
prefixedRest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOnce transaction has been sent to chain, we check for its execution status.
+transactions that were sent to chain and are 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 chain
+an Aptos account
+a sequence number the transaction will be generated with
+Return the number of listeners listening to a given event.
+Return the listeners registered for a given event.
+Optional
fn: ((...args) => 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: anyReads the outstanding transaction queue and submits the transaction to chain.
+If the transaction has fulfilled, it pushes the transaction to the processed +transactions queue and fires a transactionsFulfilled event.
+If the transaction has failed, it pushes the transaction to the processed +transactions queue with the failure reason and fires a transactionsFailed event.
+Push transaction to the transactions queue
+Transaction payload
+Optional
options: InputGenerateTransactionOptionsRemove the listeners of a given event.
+Optional
fn: ((...args) => void)Rest
...args: ArgumentMap<TransactionWorkerEvents>[Extract<T, keyof TransactionWorkerEvents>]Optional
context: anyOptional
once: booleanAbstract
Abstract
serializeAbstract
toStatic
deserializeStatic
deserializeStatic
loadStatic
deserializeStatic
loadGenerics are used for type parameters in entry functions. However, +they are not actually serialized into a real type, so they cannot be +used as a type directly.
+Readonly
valueStatic
deserializeStatic
loadOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureReadonly
valueStatic
deserializeStatic
loadStatic
deserializeStatic
loadReadonly
valueStatic
deserializeStatic
loadStatic
deserializeStatic
loadStatic
deserializeStatic
loadStatic
deserializeStatic
loadStatic
deserializeStatic
loadStatic
deserializeStatic
loadStatic
deserializeStatic
loadReadonly
valueStatic
deserializeStatic
loadStatic
u8Readonly
valueSerialize 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.
+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
deserializeReadonly
valueSerialize 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.
+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
deserializeReadonly
valueSerialize 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.
+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
deserializeReadonly
valueSerialize 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.
+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
deserializeReadonly
valueSerialize 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.
+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
deserializeReadonly
valueSerialize 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.
+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
deserializeThe signature representation of a proof
+Optional
extraOptional
overrideOptional
trainingReadonly
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
+Static
deserializeStatic
fromReturn a ZeroKnowledgeSig object from its bcs serialization in bytes.
+ZeroKnowledgeSig
+A container for a different zero knowledge proof types
+Readonly
proofPrivate
Readonly
variantIndex of the underlying enum variant
+Static
deserializeTransaction Authenticator enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414
+This enum is used to explain why an address was invalid.
+Scheme used for deriving account addresses from other data
+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
+A list of supported key types and associated seeds
+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
+The list of supported Processor types for our indexer api.
+These can be found from the processor_status table in the indexer database. +https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql
+Script transaction arguments enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11
+Transaction Authenticator enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44
+Transaction payload enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478
+TRANSACTION TYPES
+Transaction variants enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440
+TypeTag enum as they are represented in Rust +https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27
+Derive a child key from the private key
+The main function to use when doing an API request.
+AptosRequest
+The config information for the SDK client instance
+the response or AptosApiError
+We are defining function signatures, each with its specific input and output.
+These are the possible function signature for our generateTransaction
function.
+When we call our generateTransaction
function with the relevant type properties,
+Typescript can infer the return type based on the appropriate function overload.
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
+An instance of a RawTransaction, plus optional secondary/fee payer addresses
+{
rawTransaction: RawTransaction,
secondarySignerAddresses? : Array<AccountAddress>,
feePayerAddress?: AccountAddress
}
+
+Amount is represented in the smallest unit format on chain, this function converts +a human readable amount format to the smallest unit format
+The value in human readable format
+The token decimal
+The value is smallest units
+human readable amount format: 500
on chain amount format when decimal is 8: 50000000000
+
+Amount is represented in the smallest unit format on chain, this function converts +the smallest unit format to a human readable amount format
+The value in human readable format
+The token decimal
+The value is smallest units
+human readable amount format: 500
on chain amount format when decimal is 8: 50000000000
+
+Converts a non-BCS encoded argument into BCS encoded, if necessary
+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 an 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
+Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
+A aptos transaction type
+FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction
+Deserialize a Script Transaction Argument
+Fetches the ABI for an entry function from the module
+Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.
+Fetches the ABI for a view function from the module
+Finds first non-signer arg.
+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.
Generates a raw transaction
+AptosConfig
+Optional
feeOptional
options?: InputGenerateTransactionOptionsThe transaction payload - can create by using generateTransactionPayload()
+The transaction's sender account address as a hex input
+RawTransaction
+Generates the 'signing message' form of a message to be signed.
+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
+Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.
+Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of +its constructor as the domain separator.
+Generates the 'signing message' form of a transaction. It derives the type of transaction and +applies the appropriate domain separator based on if there is extra data such as a fee payer or +secondary signers.
+A transaction that is to be signed
+The Uint8Array of the signing message
+We are defining function signatures, each with its specific input and output.
+These are the possible function signature for our generateTransactionPayload
function.
+When we call our generateTransactionPayload
function with the relevant type properties,
+Typescript can infer the return type based on the appropriate function overload.
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
+TransactionPayload
+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
+TransactionPayload
+Generates a user transaction hash for the given transaction payload. It must already have an authenticator
+InputSubmitTransactionData
+Main function to do a Get request
+GetRequestOptions
+Makes a get request to the pepper service
+GetAptosRequestOptions
+AptosResponse
+Gets the parameters of how Keyless Accounts are configured on chain including the verifying key and the max expiry horizon
+Optional
options?: LedgerVersionArgKeylessConfiguration
+Checks if an ED25519 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
+Determines whether the given object is an encoded struct type with the following properties:
+The object to check
+Whether the object is an encoded struct type
+Aptos derive path is 637
+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, last two components must be non-hardened.
+path string (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.
+path string (e.g. m/44'/637'/0'/0'/0'
).
Utility function that serializes and deserialize an object back into the same bundle as the sdk.
+This is a workaround to have the instanceof
operator work when input objects come from a different
+bundle.
The class of the object to normalize
+the instance to normalize
+Convert an encoded struct to a MoveStructId.
+The struct with account_address, module_name, and struct_name properties
+The MoveStructId
+const structObj = {
account_address: "0x1",
module_name: "0x6170746f735f636f696e",
struct_name: "0x4170746f73436f696e",
};
// structId is "0x1::aptos_coin::AptosCoin"
const structId = parseEncodedStruct(structObj);
+
+All types are made of a few parts they're either:
+There are a few more special cases that need to be handled, however.
+Optional
options: { Optional
allowMain function to do a Post request
+PostRequestOptions
+Makes a post request to the pepper service
+GetAptosRequestOptions
+AptosResponse
+Given a url and method, sends the request with axios and +returns the response.
+Convert type arguments to only type tags, allowing for string representations of type tags
+Optional
typeArguments: TypeArgument[]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.
+The API response type
+the response status. i.e. 200
+the response message
+the response data
+the url the request was made to
+the response headers
+(optional) - the request object
+(optional) - the request object
+Optional
configOptional
requestOptional
bodyOptional
contentOptional
headersOptional
originOptional
overridesOptional
API_Optional
WITH_Optional
AUTH_Optional
paramsOptional
configOptional
headersOptional
requestOptional
responseArguments for creating an opaque Account
from any supported private key.
+This is used when the private key type is not known at compilation time.
Optional
addressOptional
legacyArguments for creating an Ed25519Account
from an Ed25519PrivateKey
.
+This is the default input type when passing an Ed25519PrivateKey
.
+In order to use the SingleKey authentication scheme, legacy
needs to be explicitly set to false.
Optional
addressOptional
legacyArguments for creating an SingleKeyAccount
from an Ed25519PrivateKey
.
+The legacy
argument needs to be explicitly set to false in order to
+use the SingleKey
authentication scheme.
Optional
addressArguments for creating an SingleKeyAccount
from any supported private key
+that is not an Ed25519PrivateKey
.
+The legacy
argument defaults to false and cannot be explicitly set to true.
Optional
addressOptional
legacyThis interface exists to define Deserializable
Optional
addressSerialize 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.
+Interface of the arguments to generate a multi-agent transaction.
+Used to provide to generateTransaction()
method in the transaction builder flow
Optional
feeOptional
optionsInterface that holds the user data input when generating a multi-agent transaction
+Optional
optionsOptional
withInterface of the arguments to generate a single signer transaction.
+Used to provide to generateTransaction()
method in the transaction builder flow
Optional
feeOptional
optionsInterface that holds the user data input when generating a single signer transaction
+Optional
optionsOptional
secondaryOptional
withInterface that holds the user data input when submitting a transaction
+Optional
additionalOptional
feeControls the number of results that are returned and the starting position of those results.
+parameter specifies the starting position of the query result within the set of data. Default is 0.
+specifies the maximum number of items or records to return in a query result. Default is 25.
+Optional
limitOptional
offsetAn abstract representation of a private key. +It is associated to a signature scheme and provides signing capabilities.
+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.
+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.
+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.
+The union of all single account signatures.
+Unified type that holds all the return interfaces when generating different transaction types
+Type that holds all raw transaction instances Aptos SDK supports
+The generated transaction payload type that was produces from generateTransactionPayload()
function.
The API request type
+Optional
acceptOptional
body?: anyOptional
contentOptional
originOptional
overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfigOptional
params?: Record<string, string | AnyNumber | boolean | undefined>Optional
path?: stringthe url to make the request to, i.e https://fullnode.devnet.aptoslabs.com/v1
+the request method "GET" | "POST"
+(optional) - the endpoint to make the request to, i.e transactions
+(optional) - the body of the request
+(optional) - the content type to set the content-type
header to,
+by default is set to application/json
(optional) - query params to add to the request
+(optional) - the local method the request came from
+(optional) - a ClientConfig
object type to override request data
Set of configuration options that can be provided when initializing the SDK. +The purpose of these options is to configure various aspects of the SDK's +behavior and interaction with the Aptos network
+Optional
Readonly
client?: ClientOptional
Readonly
clientOptional
Readonly
faucet?: stringOptional
Readonly
faucetOptional
Readonly
fullnode?: stringOptional
Readonly
fullnodeOptional
Readonly
indexer?: stringOptional
Readonly
indexerOptional
Readonly
network?: NetworkOptional
Readonly
pepper?: stringOptional
Readonly
prover?: stringA list of Authentication Key schemes that are supported by Aptos.
+They are combinations of signing schemes and derive schemes.
+A Block type
+Optional
transactions?: TransactionResponse[]The transactions in the block in sequential order
+BlockEndInfo describes the gas state of the block
+BlockEpilogueTransactionResponse is a transaction that is executed at the end of a block keeping track of data from +the whole 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
+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 we can pass with the request to the server.
+Optional
API_Optional
WITH_api key generated from developer portal https://developers.aptoslabs.com/manage/api-keys}
+extra headers we want to send with the request
+whether to carry cookies. By default, it is set to true and cookies will be sent
+General type definition for client HEADERS
+Optional
HEADERS?: Record<string, string | number | boolean>Key of table in JSON
+Type of key
+Value of table in JSON
+Type of value
+Deleted table data
+Deleted key
+Deleted key type
+Interface of an Entry function's ABI.
+This is used to provide type checking and simple input conversion on ABI based transaction submission.
+Optional
signers?: numberEntry function arguments to be used when building a raw transaction using BCS serialized arguments
+Arguments of the function
+Type arguments of the function
+A Faucet only configuration object
+Optional
AUTH_extra headers we want to send with the request
+an auth token to send with a faucet request
+A Fullnode only configuration object
+extra headers we want to send with the request
+Data need for a generic function ABI, both view and entry
+Type holding the outputs of the estimate gas API
+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 Single Signer +Secp256k1
+Optional
legacy?: falseFinal 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
+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)
+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, string | AnyNumber | boolean | undefined>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 graphql query type to pass into the queryIndexer
function
Optional
variables?: {}Hex data as input to a function
+An Indexer only configuration object
+extra headers we want to send with the request
+The data needed to generate an Entry Function payload
+Optional
abi?: EntryFunctionABIOptional
typeUnified type that holds all the interfaces to generate different transaction types
+Unified type that holds all the user data input interfaces when generating different transaction types
+Optional options to set when generating a transaction
+Optional
accountOptional
expireOptional
gasOptional
maxUnified type for the data needed to generate a transaction payload of types: +Entry Function | Script | Multi Sig
+The data needed to generate a Multi Sig payload
+The data needed to generate a Multi Sig payload
+The data needed to generate a Script payload
+Optional
typeOptional
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()
Optional
estimateOptional
estimateOptional
estimateThe data needed to generate a View Function payload
+Optional
abi?: ViewFunctionABIOptional
functionOptional
typeData needed to generate a view function, with an already fetched ABI
+Data needed to generate a view function payload and fetch the remote ABI
+The data needed to generate a View Function payload in JSON
+Optional
functionOptional
typeChain 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.
+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 tied to the generic type param and associated with the function that uses it
+A Move module
+Public functions of the module
+Friends of the module
+Structs of the module
+Optional
abi?: MoveModuleMove module id is a string representation of Move module. +Module name is case-sensitive.
+Move script bytecode
+Optional
abi?: MoveFunctionA 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
+Move struct field
+This is the format for a fully qualified struct, resource, or entry function in Move.
+Map of Move types to local TypeScript types
+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
Optional
transaction_A generic type that being passed by each function and holds an +array of properties we can sort the query by
+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.
+Optional
signature?: TransactionSignatureOptional
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, string | AnyNumber | boolean | undefined>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 to be used when building a raw transaction using BCS serialized arguments
+Arguments of the function
+Type arguments of the function
+Entry function arguments to be used when building a raw transaction using remote ABI
+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
+Refers to the token standard we want to query for
+The other involved parties' addresses
+The associated signatures, in the same order as the secondary addresses
+The other involved parties' addresses
+The associated signatures, in the same order as the secondary addresses
+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
+These are the JSON representations of transaction signatures returned from the node API.
+TypeArgument inputs for Entry functions, view functions, and scripts
+This can be a string version of the type argument such as:
+BCS types
+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
+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 of an View function's ABI.
+This is used to provide type checking and simple input conversion on ABI based transaction submission.
+Payload sent to the fullnode for a JSON view request
+Option properties to pass for waitForTransaction() function
+Optional
checkOptional
timeoutOptional
waitWRITESET CHANGE TYPES
+State key hash
+Optional
data?: DeletedTableDataOptional
data?: DecodedTableDataConst
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
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.
+