This 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.

Example

const aptos = new Aptos();

Hierarchy

  • Account
  • ANS
  • Coin
  • DigitalAsset
  • Event
  • Faucet
  • FungibleAsset
  • General
  • Keyless
  • Staking
  • Table
  • Omit<Transaction, "build" | "simulate" | "submit" | "batch">
    • Aptos

Constructors

Properties

Methods

addDigitalAssetPropertyTransaction addDigitalAssetTypedPropertyTransaction batchTransactionsForSingleAccount burnDigitalAssetTransaction createCollectionTransaction deriveAccountFromPrivateKey deriveKeylessAccount freezeDigitalAssetTransaferTransaction fundAccount getAccountAPTAmount getAccountCoinAmount getAccountCoinsCount getAccountCoinsData getAccountCollectionsWithOwnedTokens getAccountDomains getAccountEventsByCreationNumber getAccountEventsByEventType getAccountInfo getAccountModule getAccountModules getAccountNames getAccountOwnedObjects getAccountOwnedTokens getAccountOwnedTokensFromCollectionAddress getAccountResource getAccountResources getAccountSubdomains getAccountTokensCount getAccountTransactions getAccountTransactionsCount getBlockByHeight getBlockByVersion getChainId getChainTopUserTransactions getCollectionData getCollectionDataByCollectionId getCollectionId getCurrentDigitalAssetOwnership getCurrentFungibleAssetBalances getDelegatedStakingActivities getDigitalAssetActivity getDigitalAssetData getDomainSubdomains getEvents getExpiration getFungibleAssetActivities getFungibleAssetMetadata getFungibleAssetMetadataByAssetType getGasPriceEstimation getIndexerLastSuccessVersion getLedgerInfo getModuleEventsByEventType getName getNumberOfDelegators getNumberOfDelegatorsForAllPools getOwnedDigitalAssets getOwnerAddress getPepper getPrimaryName getProcessorStatus getProof getSigningMessage getTableItem getTableItemsData getTableItemsMetadata getTargetAddress getTransactionByHash getTransactionByVersion getTransactions isPendingTransaction lookupOriginalAccountAddress mintDigitalAssetTransaction mintSoulBoundTransaction publishPackageTransaction queryIndexer registerName removeDigitalAssetPropertyTransaction renewDomain rotateAuthKey setDigitalAssetDescriptionTransaction setDigitalAssetNameTransaction setDigitalAssetURITransaction setPrimaryName setTargetAddress sign signAndSubmitTransaction signAsFeePayer transferCoinTransaction transferDigitalAssetTransaction transferFungibleAsset unfreezeDigitalAssetTransaferTransaction updateDigitalAssetPropertyTransaction updateDigitalAssetTypedPropertyTransaction view waitForTransaction

Constructors

Properties

account: Account
ans: ANS
coin: Coin
config: AptosConfig
digitalAsset: DigitalAsset
event: Event
faucet: Faucet
fungibleAsset: FungibleAsset
general: General
keyless: Keyless
staking: Staking
table: Table
transaction: Transaction

Methods

  • Add a digital asset property

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          propertyKey: string;
          propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY";
          propertyValue: PropertyValue;
      }
      • creator: Account
      • digitalAssetAddress: AccountAddressInput

        The digital asset address

      • Optional digitalAssetType?: `${string}::${string}::${string}`
      • Optional options?: InputGenerateTransactionOptions
      • propertyKey: string

        The property key for storing on-chain properties

      • propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY"

        The type of property value

      • propertyValue: PropertyValue

        The property value to be stored on-chain

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.addDigitalAssetPropertyTransaction({
    creator: alice,
    propertyKey: "newKey",
    propertyType: "BOOLEAN",
    propertyValue: true,
    digitalAssetAddress: "0x123",
    });
  • Add a typed digital asset property

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          propertyKey: string;
          propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY";
          propertyValue: PropertyValue;
      }
      • creator: Account
      • digitalAssetAddress: AccountAddressInput

        The digital asset address

      • Optional digitalAssetType?: `${string}::${string}::${string}`
      • Optional options?: InputGenerateTransactionOptions
      • propertyKey: string

        The property key for storing on-chain properties

      • propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY"

        The type of property value

      • propertyValue: PropertyValue

        The property value to be stored on-chain

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({
    creator: alice,
    propertyKey: "typedKey",
    propertyType: "STRING",
    propertyValue: "hello",
    digitalAssetAddress: "0x123",
    });
  • Parameters

    Returns Promise<void>

    void. Throws if any error

    Deprecated

    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.

  • Creates a new collection within the specified account

    Parameters

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that when submitted will create the collection.

    Example

    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.

    Parameters

    Returns Promise<Account>

    Account type

    Example

    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

    Parameters

    • args: {
          ephemeralKeyPair: EphemeralKeyPair;
          jwt: string;
          pepper?: HexInput;
          proofFetchCallback?: ProofFetchCallback;
          uidKey?: string;
      }
      • ephemeralKeyPair: EphemeralKeyPair

        the EphemeralKeyPair used to generate the nonce in the JWT token

      • jwt: string

        JWT token

      • Optional pepper?: HexInput

        the pepper

      • Optional proofFetchCallback?: ProofFetchCallback

        a 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 uidKey?: string

        a key in the JWT token to use to set the uidVal in the IdCommitment

    Returns Promise<KeylessAccount>

    A KeylessAccount that can be used to sign transactions

  • Queries the account's APT amount

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the total count for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<number>

    Current amount of account's APT

    Example

    const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:"0x123"})
    
  • Queries the account's coin amount by the coin type

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          coinType: `${string}::${string}::${string}`;
          minimumLedgerVersion?: AnyNumber;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the total count for

      • coinType: `${string}::${string}::${string}`

        The coin type to query

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<number>

    Current amount of account's coin

    Example

    const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:"0x123", coinType:"0x1::aptos_coin::AptosCoin"})
    
  • Queries the current count of an account's coins aggregated

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the total count for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<number>

    Current count of the aggregated count of all account's coins

    Example

    const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:"0x123"})
    
  • Queries an account's coins data

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              amount: any;
              asset_type: string;
              is_frozen: boolean;
              is_primary: boolean;
              last_transaction_timestamp: any;
              last_transaction_version: any;
              metadata?: null | {
                  asset_type: string;
                  creator_address: string;
                  decimals: number;
                  icon_uri?: null | string;
                  last_transaction_timestamp: any;
                  last_transaction_version: any;
                  name: string;
                  project_uri?: null | string;
                  supply_aggregator_table_handle_v1?: null | string;
                  supply_aggregator_table_key_v1?: null | string;
                  symbol: string;
                  token_standard: string;
              };
              owner_address: string;
              storage_id: string;
              token_standard: string;
          }> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the coins data for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            amount: any;
            asset_type: string;
            is_frozen: boolean;
            is_primary: boolean;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            metadata?: null | {
                asset_type: string;
                creator_address: string;
                decimals: number;
                icon_uri?: null | string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                name: string;
                project_uri?: null | string;
                supply_aggregator_table_handle_v1?: null | string;
                supply_aggregator_table_key_v1?: null | string;
                symbol: string;
                token_standard: string;
            };
            owner_address: string;
            storage_id: string;
            token_standard: string;
        }> & WhereArg<CurrentFungibleAssetBalancesBoolExp>

    Returns Promise<{
        amount: any;
        asset_type: string;
        is_frozen: boolean;
        is_primary: boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        metadata?: null | {
            asset_type: string;
            creator_address: string;
            decimals: number;
            icon_uri?: null | string;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            name: string;
            project_uri?: null | string;
            supply_aggregator_table_handle_v1?: null | string;
            supply_aggregator_table_key_v1?: null | string;
            symbol: string;
            token_standard: string;
        };
        owner_address: string;
        storage_id: string;
        token_standard: string;
    }[]>

    Array with the coins data

    Example

    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

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: TokenStandardArg & PaginationArgs & OrderByArg<{
              collection_id?: null | string;
              collection_name?: null | string;
              collection_uri?: null | string;
              creator_address?: null | string;
              current_collection?: null | {
                  collection_id: string;
                  collection_name: string;
                  creator_address: string;
                  current_supply: any;
                  description: string;
                  last_transaction_timestamp: any;
                  last_transaction_version: any;
                  max_supply?: any;
                  mutable_description?: null | boolean;
                  mutable_uri?: null | boolean;
                  table_handle_v1?: null | string;
                  token_standard: string;
                  total_minted_v2?: any;
                  uri: string;
              };
              distinct_tokens?: any;
              last_transaction_version?: any;
              owner_address?: null | string;
              single_token_uri?: null | string;
          }>;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the collections for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: TokenStandardArg & PaginationArgs & OrderByArg<{
            collection_id?: null | string;
            collection_name?: null | string;
            collection_uri?: null | string;
            creator_address?: null | string;
            current_collection?: null | {
                collection_id: string;
                collection_name: string;
                creator_address: string;
                current_supply: any;
                description: string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                max_supply?: any;
                mutable_description?: null | boolean;
                mutable_uri?: null | boolean;
                table_handle_v1?: null | string;
                token_standard: string;
                total_minted_v2?: any;
                uri: string;
            };
            distinct_tokens?: any;
            last_transaction_version?: any;
            owner_address?: null | string;
            single_token_uri?: null | string;
        }>

    Returns Promise<{
        collection_id?: null | string;
        collection_name?: null | string;
        collection_uri?: null | string;
        creator_address?: null | string;
        current_collection?: null | {
            collection_id: string;
            collection_name: string;
            creator_address: string;
            current_supply: any;
            description: string;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            max_supply?: any;
            mutable_description?: null | boolean;
            mutable_uri?: null | boolean;
            table_handle_v1?: null | string;
            token_standard: string;
            total_minted_v2?: any;
            uri: string;
        };
        distinct_tokens?: any;
        last_transaction_version?: any;
        owner_address?: null | string;
        single_token_uri?: null | string;
    }[]>

    Collections array with the collections data

    Example

    const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:"0x123"})
    
  • Fetches all top level domain names for an account

    Parameters

    • args: GetAccountDomainsArgs

    Returns Promise<{
        domain?: null | string;
        expiration_timestamp?: any;
        is_primary?: null | boolean;
        owner_address?: null | string;
        registered_address?: null | string;
        subdomain?: null | string;
        token_standard?: null | string;
    }[]>

    a promise of an array of ANSName

  • Get events by creation number and an account address

    Parameters

    Returns Promise<{
        account_address: string;
        creation_number: any;
        data: any;
        event_index: any;
        indexed_type: string;
        sequence_number: any;
        transaction_block_height: any;
        transaction_version: any;
        type: string;
    }[]>

    Promise

    Example

    const events = await aptos.getAccountEventsByCreationNumber({accountAddress:"0x123",creationNumber: 0})
    
  • Get events by event type and an account address

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          eventType: `${string}::${string}::${string}`;
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              account_address: string;
              creation_number: any;
              data: any;
              event_index: any;
              indexed_type: string;
              sequence_number: any;
              transaction_block_height: any;
              transaction_version: any;
              type: string;
          }>;
      }
      • accountAddress: AccountAddressInput

        The account address

      • eventType: `${string}::${string}::${string}`

        The event type

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            account_address: string;
            creation_number: any;
            data: any;
            event_index: any;
            indexed_type: string;
            sequence_number: any;
            transaction_block_height: any;
            transaction_version: any;
            type: string;
        }>

    Returns Promise<{
        account_address: string;
        creation_number: any;
        data: any;
        event_index: any;
        indexed_type: string;
        sequence_number: any;
        transaction_block_height: any;
        transaction_version: any;
        type: string;
    }[]>

    Promise

    Example

    const events = await aptos.getAccountEventsByEventType({accountAddress:"0x123",eventType: "0x1::transaction_fee::FeeStatement"})
    
  • Queries the current state for an Aptos account given its account address

    Parameters

    Returns Promise<AccountData>

    The account data

    Example: An example of the returned account

    {
    sequence_number: "1",
    authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69"
    }
  • Queries for a specific account module given account address and module name

    Parameters

    Returns Promise<MoveModuleBytecode>

    Account module

    Example

    const module = await aptos.getAccountModule({accountAddress:"0x456"}) // An example of an account module response

    {
    bytecode: "0xa11ceb0b0600000006010002030206050807070f0d081c200",
    abi: { address: "0x1" }
    }
  • Fetches all names for an account (both top level domains and subdomains)

    Parameters

    • args: GetAccountNamesArgs

    Returns Promise<{
        domain?: null | string;
        expiration_timestamp?: any;
        is_primary?: null | boolean;
        owner_address?: null | string;
        registered_address?: null | string;
        subdomain?: null | string;
        token_standard?: null | string;
    }[]>

    a promise of an array of ANSName

  • Queries an account's owned objects

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              allow_ungated_transfer: boolean;
              is_deleted: boolean;
              last_guid_creation_num: any;
              last_transaction_version: any;
              object_address: string;
              owner_address: string;
              state_key_hash: string;
          }>;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the objects for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            allow_ungated_transfer: boolean;
            is_deleted: boolean;
            last_guid_creation_num: any;
            last_transaction_version: any;
            object_address: string;
            owner_address: string;
            state_key_hash: string;
        }>

    Returns Promise<{
        allow_ungated_transfer: boolean;
        is_deleted: boolean;
        last_guid_creation_num: any;
        last_transaction_version: any;
        object_address: string;
        owner_address: string;
        state_key_hash: string;
    }[]>

    Objects array with the object data

    Example

    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

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: TokenStandardArg & PaginationArgs & OrderByArg<{
              amount: any;
              current_token_data?: null | {
                  collection_id: string;
                  current_collection?: null | {
                      collection_id: string;
                      collection_name: string;
                      creator_address: string;
                      current_supply: any;
                      description: string;
                      last_transaction_timestamp: any;
                      last_transaction_version: any;
                      max_supply?: any;
                      mutable_description?: null | boolean;
                      mutable_uri?: null | boolean;
                      table_handle_v1?: null | string;
                      token_standard: string;
                      total_minted_v2?: any;
                      uri: string;
                  };
                  decimals?: any;
                  description: string;
                  is_fungible_v2?: null | boolean;
                  largest_property_version_v1?: any;
                  last_transaction_timestamp: any;
                  last_transaction_version: any;
                  maximum?: any;
                  supply?: any;
                  token_data_id: string;
                  token_name: string;
                  token_properties: any;
                  token_standard: string;
                  token_uri: string;
              };
              is_fungible_v2?: null | boolean;
              is_soulbound_v2?: null | boolean;
              last_transaction_timestamp: any;
              last_transaction_version: any;
              owner_address: string;
              property_version_v1: any;
              storage_id: string;
              table_type_v1?: null | string;
              token_data_id: string;
              token_properties_mutated_v1?: any;
              token_standard: string;
          }>;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the tokens for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: TokenStandardArg & PaginationArgs & OrderByArg<{
            amount: any;
            current_token_data?: null | {
                collection_id: string;
                current_collection?: null | {
                    collection_id: string;
                    collection_name: string;
                    creator_address: string;
                    current_supply: any;
                    description: string;
                    last_transaction_timestamp: any;
                    last_transaction_version: any;
                    max_supply?: any;
                    mutable_description?: null | boolean;
                    mutable_uri?: null | boolean;
                    table_handle_v1?: null | string;
                    token_standard: string;
                    total_minted_v2?: any;
                    uri: string;
                };
                decimals?: any;
                description: string;
                is_fungible_v2?: null | boolean;
                largest_property_version_v1?: any;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                maximum?: any;
                supply?: any;
                token_data_id: string;
                token_name: string;
                token_properties: any;
                token_standard: string;
                token_uri: string;
            };
            is_fungible_v2?: null | boolean;
            is_soulbound_v2?: null | boolean;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            owner_address: string;
            property_version_v1: any;
            storage_id: string;
            table_type_v1?: null | string;
            token_data_id: string;
            token_properties_mutated_v1?: any;
            token_standard: string;
        }>

    Returns Promise<{
        amount: any;
        current_token_data?: null | {
            collection_id: string;
            current_collection?: null | {
                collection_id: string;
                collection_name: string;
                creator_address: string;
                current_supply: any;
                description: string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                max_supply?: any;
                mutable_description?: null | boolean;
                mutable_uri?: null | boolean;
                table_handle_v1?: null | string;
                token_standard: string;
                total_minted_v2?: any;
                uri: string;
            };
            decimals?: any;
            description: string;
            is_fungible_v2?: null | boolean;
            largest_property_version_v1?: any;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            maximum?: any;
            supply?: any;
            token_data_id: string;
            token_name: string;
            token_properties: any;
            token_standard: string;
            token_uri: string;
        };
        is_fungible_v2?: null | boolean;
        is_soulbound_v2?: null | boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        owner_address: string;
        property_version_v1: any;
        storage_id: string;
        table_type_v1?: null | string;
        token_data_id: string;
        token_properties_mutated_v1?: any;
        token_standard: string;
    }[]>

    Tokens array with the token data

    Example

    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

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          collectionAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: TokenStandardArg & PaginationArgs & OrderByArg<{
              amount: any;
              current_token_data?: null | {
                  collection_id: string;
                  current_collection?: null | {
                      collection_id: string;
                      collection_name: string;
                      creator_address: string;
                      current_supply: any;
                      description: string;
                      last_transaction_timestamp: any;
                      last_transaction_version: any;
                      max_supply?: any;
                      mutable_description?: null | boolean;
                      mutable_uri?: null | boolean;
                      table_handle_v1?: null | string;
                      token_standard: string;
                      total_minted_v2?: any;
                      uri: string;
                  };
                  decimals?: any;
                  description: string;
                  is_fungible_v2?: null | boolean;
                  largest_property_version_v1?: any;
                  last_transaction_timestamp: any;
                  last_transaction_version: any;
                  maximum?: any;
                  supply?: any;
                  token_data_id: string;
                  token_name: string;
                  token_properties: any;
                  token_standard: string;
                  token_uri: string;
              };
              is_fungible_v2?: null | boolean;
              is_soulbound_v2?: null | boolean;
              last_transaction_timestamp: any;
              last_transaction_version: any;
              owner_address: string;
              property_version_v1: any;
              storage_id: string;
              table_type_v1?: null | string;
              token_data_id: string;
              token_properties_mutated_v1?: any;
              token_standard: string;
          }>;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the tokens for

      • collectionAddress: AccountAddressInput

        The address of the collection being queried

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: TokenStandardArg & PaginationArgs & OrderByArg<{
            amount: any;
            current_token_data?: null | {
                collection_id: string;
                current_collection?: null | {
                    collection_id: string;
                    collection_name: string;
                    creator_address: string;
                    current_supply: any;
                    description: string;
                    last_transaction_timestamp: any;
                    last_transaction_version: any;
                    max_supply?: any;
                    mutable_description?: null | boolean;
                    mutable_uri?: null | boolean;
                    table_handle_v1?: null | string;
                    token_standard: string;
                    total_minted_v2?: any;
                    uri: string;
                };
                decimals?: any;
                description: string;
                is_fungible_v2?: null | boolean;
                largest_property_version_v1?: any;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                maximum?: any;
                supply?: any;
                token_data_id: string;
                token_name: string;
                token_properties: any;
                token_standard: string;
                token_uri: string;
            };
            is_fungible_v2?: null | boolean;
            is_soulbound_v2?: null | boolean;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            owner_address: string;
            property_version_v1: any;
            storage_id: string;
            table_type_v1?: null | string;
            token_data_id: string;
            token_properties_mutated_v1?: any;
            token_standard: string;
        }>

    Returns Promise<{
        amount: any;
        current_token_data?: null | {
            collection_id: string;
            current_collection?: null | {
                collection_id: string;
                collection_name: string;
                creator_address: string;
                current_supply: any;
                description: string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                max_supply?: any;
                mutable_description?: null | boolean;
                mutable_uri?: null | boolean;
                table_handle_v1?: null | string;
                token_standard: string;
                total_minted_v2?: any;
                uri: string;
            };
            decimals?: any;
            description: string;
            is_fungible_v2?: null | boolean;
            largest_property_version_v1?: any;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            maximum?: any;
            supply?: any;
            token_data_id: string;
            token_name: string;
            token_properties: any;
            token_standard: string;
            token_uri: string;
        };
        is_fungible_v2?: null | boolean;
        is_soulbound_v2?: null | boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        owner_address: string;
        property_version_v1: any;
        storage_id: string;
        table_type_v1?: null | string;
        token_data_id: string;
        token_properties_mutated_v1?: any;
        token_standard: string;
    }[]>

    Tokens array with the token data

    Example

    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.

    Type Parameters

    • T extends {} = any

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          options?: LedgerVersionArg;
          resourceType: `${string}::${string}::${string}`;
      }
      • accountAddress: AccountAddressInput

        Aptos account address

      • Optional options?: LedgerVersionArg
      • resourceType: `${string}::${string}::${string}`

        String representation of an on-chain Move struct type, i.e "0x1::aptos_coin::AptosCoin"

    Returns Promise<T>

    Account resource

    Example

    const resource = await aptos.getAccountResource({accountAddress:"0x456"})
    
  • Fetches all subdomains names for an account

    Parameters

    • args: GetAccountSubdomainsArgs

    Returns Promise<{
        domain?: null | string;
        expiration_timestamp?: any;
        is_primary?: null | boolean;
        owner_address?: null | string;
        registered_address?: null | string;
        subdomain?: null | string;
        token_standard?: null | string;
    }[]>

    a promise of an array of ANSName

  • Queries the current count of tokens owned by an account

    Parameters

    Returns Promise<number>

    Current count of tokens owned by the account

    Example

    const tokensCount = await aptos.getAccountTokensCount({accountAddress:"0x456"})
    
  • Queries the current count of transactions submitted by an account

    Parameters

    • args: {
          accountAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
      }
      • accountAddress: AccountAddressInput

        The account address we want to get the total count for

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<number>

    Current count of transactions made by an account

    Example

    const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:"0x123"})
    
  • Get block by block height

    Parameters

    • args: {
          blockHeight: AnyNumber;
          options?: {
              withTransactions?: boolean;
          };
      }
      • blockHeight: AnyNumber

        Block height to lookup. Starts at 0

      • Optional options?: {
            withTransactions?: boolean;
        }
        • Optional withTransactions?: boolean

    Returns Promise<Block>

    Block with optional transactions

    Example

    const block = await aptos.getBlockByVersion({blockHeight:5})
    
  • Queries for block by transaction version

    Parameters

    • args: {
          ledgerVersion: AnyNumber;
          options?: {
              withTransactions?: boolean;
          };
      }
      • ledgerVersion: AnyNumber

        Ledger version to lookup block information for

      • Optional options?: {
            withTransactions?: boolean;
        }
        • Optional withTransactions?: boolean

    Returns Promise<Block>

    Block information with optional transactions

    Example

    const block = await aptos.getBlockByVersion({ledgerVersion:5})
    
  • Queries for the chain id

    Returns Promise<number>

    The chain id

    Example

    const chainId = await aptos.getChainId()
    
  • Queries top user transactions

    Parameters

    • args: {
          limit: number;
      }
      • limit: number

        The number of transactions to return

    Returns Promise<{
        version: any;
    }[]>

    GetChainTopUserTransactionsResponse

    Example

    const topUserTransactions = await aptos.getChainTopUserTransactions({limit:5})
    
  • 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

    Parameters

    Returns Promise<{
        collection_id: string;
        collection_name: string;
        creator_address: string;
        current_supply: any;
        description: string;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        max_supply?: any;
        mutable_description?: null | boolean;
        mutable_uri?: null | boolean;
        table_handle_v1?: null | string;
        token_standard: string;
        total_minted_v2?: any;
        uri: string;
    }>

    GetCollectionDataResponse response type

    Example

    const collection = await aptos.getCollectionData({creatorAddress:"0x123",collectionName:"myCollection"})
    
  • Queries data of a specific collection by the collection ID.

    Parameters

    • args: {
          collectionId: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
      }
      • collectionId: AccountAddressInput

        the ID of the collection, it's the same thing as the address of the collection object

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<{
        collection_id: string;
        collection_name: string;
        creator_address: string;
        current_supply: any;
        description: string;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        max_supply?: any;
        mutable_description?: null | boolean;
        mutable_uri?: null | boolean;
        table_handle_v1?: null | string;
        token_standard: string;
        total_minted_v2?: any;
        uri: string;
    }>

    GetCollectionDataResponse response type

    Example

    const collection = await aptos.getCollectionDataByCollectionId({collectionId:"0x123"})
    
  • 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

    Parameters

    Returns Promise<string>

    the collection id

    Example

    const collection = await aptos.getCollectionId({creatorAddress:"0x123",collectionName:"myCollection"})
    
  • Gets digital asset ownership data given the address of a digital asset.

    Parameters

    Returns Promise<{
        amount: any;
        current_token_data?: null | {
            collection_id: string;
            current_collection?: null | {
                collection_id: string;
                collection_name: string;
                creator_address: string;
                current_supply: any;
                description: string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                max_supply?: any;
                mutable_description?: null | boolean;
                mutable_uri?: null | boolean;
                table_handle_v1?: null | string;
                token_standard: string;
                total_minted_v2?: any;
                uri: string;
            };
            decimals?: any;
            description: string;
            is_fungible_v2?: null | boolean;
            largest_property_version_v1?: any;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            maximum?: any;
            supply?: any;
            token_data_id: string;
            token_name: string;
            token_properties: any;
            token_standard: string;
            token_uri: string;
        };
        is_fungible_v2?: null | boolean;
        is_soulbound_v2?: null | boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        owner_address: string;
        property_version_v1: any;
        storage_id: string;
        table_type_v1?: null | string;
        token_data_id: string;
        token_properties_mutated_v1?: any;
        token_standard: string;
    }>

    GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.

    Example

    const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({digitalAssetAddress:"0x123"})
    
  • Queries all fungible asset balances

    Parameters

    • Optional args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>

        Optional configuration for pagination and filtering

    Returns Promise<{
        amount: any;
        asset_type: string;
        is_frozen: boolean;
        is_primary: boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        owner_address: string;
        storage_id: string;
        token_standard: string;
    }[]>

    A list of fungible asset metadata

    Example

    const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances()
    
  • Queries delegated staking activities

    Parameters

    Returns Promise<{
        amount: any;
        delegator_address: string;
        event_index: any;
        event_type: string;
        pool_address: string;
        transaction_version: any;
    }[]>

    GetDelegatedStakingActivitiesResponse response type

    Example

    const delegators = await aptos.getDelegatedStakingActivities({delegatorAddress:"0x123",poolAddress:"0x456"})
    
  • Gets the activity data given the address of a digital asset.

    Parameters

    • args: {
          digitalAssetAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              after_value?: null | string;
              before_value?: null | string;
              entry_function_id_str?: null | string;
              event_account_address: string;
              event_index: any;
              from_address?: null | string;
              is_fungible_v2?: null | boolean;
              property_version_v1: any;
              to_address?: null | string;
              token_amount: any;
              token_data_id: string;
              token_standard: string;
              transaction_timestamp: any;
              transaction_version: any;
              type: string;
          }>;
      }
      • digitalAssetAddress: AccountAddressInput
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            after_value?: null | string;
            before_value?: null | string;
            entry_function_id_str?: null | string;
            event_account_address: string;
            event_index: any;
            from_address?: null | string;
            is_fungible_v2?: null | boolean;
            property_version_v1: any;
            to_address?: null | string;
            token_amount: any;
            token_data_id: string;
            token_standard: string;
            transaction_timestamp: any;
            transaction_version: any;
            type: string;
        }>

    Returns Promise<{
        after_value?: null | string;
        before_value?: null | string;
        entry_function_id_str?: null | string;
        event_account_address: string;
        event_index: any;
        from_address?: null | string;
        is_fungible_v2?: null | boolean;
        property_version_v1: any;
        to_address?: null | string;
        token_amount: any;
        token_data_id: string;
        token_standard: string;
        transaction_timestamp: any;
        transaction_version: any;
        type: string;
    }[]>

    GetTokenActivityResponse containing relevant activity data to the digital asset.

    Example

    const digitalAssetActivity = await aptos.getDigitalAssetActivity({digitalAssetAddress:"0x123"})
    
  • Gets digital asset data given the address of a digital asset.

    Parameters

    Returns Promise<{
        collection_id: string;
        current_collection?: null | {
            collection_id: string;
            collection_name: string;
            creator_address: string;
            current_supply: any;
            description: string;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            max_supply?: any;
            mutable_description?: null | boolean;
            mutable_uri?: null | boolean;
            table_handle_v1?: null | string;
            token_standard: string;
            total_minted_v2?: any;
            uri: string;
        };
        decimals?: any;
        description: string;
        is_fungible_v2?: null | boolean;
        largest_property_version_v1?: any;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        maximum?: any;
        supply?: any;
        token_data_id: string;
        token_name: string;
        token_properties: any;
        token_standard: string;
        token_uri: string;
    }>

    GetTokenDataResponse containing relevant data to the digital asset.

    Example

    const digitalAsset = await aptos.getDigitalAssetData({digitalAssetAddress:"0x123"})
    
  • Fetches all subdomains names for a given domain. Note, this will not return the domain itself.

    Parameters

    • args: GetDomainSubdomainsArgs

    Returns Promise<{
        domain?: null | string;
        expiration_timestamp?: any;
        is_primary?: null | boolean;
        owner_address?: null | string;
        registered_address?: null | string;
        subdomain?: null | string;
        token_standard?: null | string;
    }[]>

    a promise of an array of ANSName

  • Get all events

    An optional where can be passed in to filter out the response.

    Parameters

    • Optional args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              account_address: string;
              creation_number: any;
              data: any;
              event_index: any;
              indexed_type: string;
              sequence_number: any;
              transaction_block_height: any;
              transaction_version: any;
              type: string;
          }> & WhereArg<EventsBoolExp>;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            account_address: string;
            creation_number: any;
            data: any;
            event_index: any;
            indexed_type: string;
            sequence_number: any;
            transaction_block_height: any;
            transaction_version: any;
            type: string;
        }> & WhereArg<EventsBoolExp>

    Returns Promise<{
        account_address: string;
        creation_number: any;
        data: any;
        event_index: any;
        indexed_type: string;
        sequence_number: any;
        transaction_block_height: any;
        transaction_version: any;
        type: string;
    }[]>

    GetEventsQuery response type

    Example

    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.

    Parameters

    • args: {
          name: string;
      }
      • name: string

        A string of the name to retrieve

    Returns Promise<undefined | number>

    number as a unix timestamp in milliseconds.

    Example

    // 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

    Parameters

    • Optional args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>

        Optional configuration for pagination and filtering

    Returns Promise<{
        amount?: any;
        asset_type: string;
        block_height: any;
        entry_function_id_str?: null | string;
        event_index: any;
        gas_fee_payer_address?: null | string;
        is_frozen?: null | boolean;
        is_gas_fee: boolean;
        is_transaction_success: boolean;
        owner_address: string;
        storage_id: string;
        storage_refund_amount: any;
        token_standard: string;
        transaction_timestamp: any;
        transaction_version: any;
        type: string;
    }[]>

    A list of fungible asset metadata

    Example

    const fungibleAssetActivities = await aptos.getFungibleAssetActivities()
    
  • Queries all fungible asset metadata.

    Parameters

    • Optional args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>

        Optional configuration for pagination and filtering

    Returns Promise<{
        asset_type: string;
        creator_address: string;
        decimals: number;
        icon_uri?: null | string;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        maximum_v2?: any;
        name: string;
        project_uri?: null | string;
        supply_aggregator_table_handle_v1?: null | string;
        supply_aggregator_table_key_v1?: null | string;
        supply_v2?: any;
        symbol: string;
        token_standard: string;
    }[]>

    A list of fungible asset metadata

    Example

    const fungibleAsset = await aptos.getFungibleAssetMetadata()
    
  • Queries a fungible asset metadata

    This query returns the fungible asset metadata for a specific fungible asset.

    Parameters

    • args: {
          assetType: string;
          minimumLedgerVersion?: AnyNumber;
      }
      • assetType: string

        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 minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

    Returns Promise<{
        asset_type: string;
        creator_address: string;
        decimals: number;
        icon_uri?: null | string;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        maximum_v2?: any;
        name: string;
        project_uri?: null | string;
        supply_aggregator_table_handle_v1?: null | string;
        supply_aggregator_table_key_v1?: null | string;
        supply_v2?: any;
        symbol: string;
        token_standard: string;
    }>

    A fungible asset metadata item

    Example

    const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({assetType:"0x123::test_coin::TestCoin"})
    
  • Queries for the last successful indexer version

    This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.

    Returns Promise<bigint>

    Example

    const version = await aptos.getIndexerLastSuccessVersion()
    
  • Queries for the Aptos ledger info

    Returns Promise<LedgerInfo>

    Aptos Ledger Info

    Example

    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

    Parameters

    • args: {
          eventType: `${string}::${string}::${string}`;
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              account_address: string;
              creation_number: any;
              data: any;
              event_index: any;
              indexed_type: string;
              sequence_number: any;
              transaction_block_height: any;
              transaction_version: any;
              type: string;
          }>;
      }
      • eventType: `${string}::${string}::${string}`

        The event type

      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            account_address: string;
            creation_number: any;
            data: any;
            event_index: any;
            indexed_type: string;
            sequence_number: any;
            transaction_block_height: any;
            transaction_version: any;
            type: string;
        }>

    Returns Promise<{
        account_address: string;
        creation_number: any;
        data: any;
        event_index: any;
        indexed_type: string;
        sequence_number: any;
        transaction_block_height: any;
        transaction_version: any;
        type: string;
    }[]>

    Promise

    Example

    const events = await aptos.getModuleEventsByEventType({eventType:"0x1::transaction_fee::FeeStatement"})
    
  • Fetches a single name from the indexer

    Parameters

    • args: {
          name: string;
      }
      • name: string

        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.

    Returns Promise<undefined | {
        domain?: null | string;
        expiration_timestamp?: any;
        is_primary?: null | boolean;
        owner_address?: null | string;
        registered_address?: null | string;
        subdomain?: null | string;
        token_standard?: null | string;
    }>

    A promise of an ANSName or undefined

  • Queries current number of delegators in a pool. Throws an error if the pool is not found.

    Parameters

    Returns Promise<number>

    The number of delegators for the given pool

    Example

    const delegators = await aptos.getNumberOfDelegators({poolAddress:"0x123"})
    
  • Queries current number of delegators in a pool. Throws an error if the pool is not found.

    Parameters

    • Optional args: {
          minimumLedgerVersion?: AnyNumber;
          options?: OrderByArg<{
              num_active_delegator?: any;
              pool_address?: null | string;
          }>;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: OrderByArg<{
            num_active_delegator?: any;
            pool_address?: null | string;
        }>

    Returns Promise<{
        num_active_delegator?: any;
        pool_address?: null | string;
    }[]>

    GetNumberOfDelegatorsForAllPoolsResponse response type

    Example

    const delegators = await aptos.getNumberOfDelegatorsForAllPools()
    
  • Gets the digital assets that the given address owns.

    Parameters

    • args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & OrderByArg<{
              amount: any;
              current_token_data?: null | {
                  collection_id: string;
                  current_collection?: null | {
                      collection_id: string;
                      collection_name: string;
                      creator_address: string;
                      current_supply: any;
                      description: string;
                      last_transaction_timestamp: any;
                      last_transaction_version: any;
                      max_supply?: any;
                      mutable_description?: null | boolean;
                      mutable_uri?: null | boolean;
                      table_handle_v1?: null | string;
                      token_standard: string;
                      total_minted_v2?: any;
                      uri: string;
                  };
                  decimals?: any;
                  description: string;
                  is_fungible_v2?: null | boolean;
                  largest_property_version_v1?: any;
                  last_transaction_timestamp: any;
                  last_transaction_version: any;
                  maximum?: any;
                  supply?: any;
                  token_data_id: string;
                  token_name: string;
                  token_properties: any;
                  token_standard: string;
                  token_uri: string;
              };
              is_fungible_v2?: null | boolean;
              is_soulbound_v2?: null | boolean;
              last_transaction_timestamp: any;
              last_transaction_version: any;
              owner_address: string;
              property_version_v1: any;
              storage_id: string;
              table_type_v1?: null | string;
              token_data_id: string;
              token_properties_mutated_v1?: any;
              token_standard: string;
          }>;
          ownerAddress: AccountAddressInput;
      }
      • Optional minimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to, before querying

      • Optional options?: PaginationArgs & OrderByArg<{
            amount: any;
            current_token_data?: null | {
                collection_id: string;
                current_collection?: null | {
                    collection_id: string;
                    collection_name: string;
                    creator_address: string;
                    current_supply: any;
                    description: string;
                    last_transaction_timestamp: any;
                    last_transaction_version: any;
                    max_supply?: any;
                    mutable_description?: null | boolean;
                    mutable_uri?: null | boolean;
                    table_handle_v1?: null | string;
                    token_standard: string;
                    total_minted_v2?: any;
                    uri: string;
                };
                decimals?: any;
                description: string;
                is_fungible_v2?: null | boolean;
                largest_property_version_v1?: any;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                maximum?: any;
                supply?: any;
                token_data_id: string;
                token_name: string;
                token_properties: any;
                token_standard: string;
                token_uri: string;
            };
            is_fungible_v2?: null | boolean;
            is_soulbound_v2?: null | boolean;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            owner_address: string;
            property_version_v1: any;
            storage_id: string;
            table_type_v1?: null | string;
            token_data_id: string;
            token_properties_mutated_v1?: any;
            token_standard: string;
        }>
      • ownerAddress: AccountAddressInput

        The address of the owner

    Returns Promise<{
        amount: any;
        current_token_data?: null | {
            collection_id: string;
            current_collection?: null | {
                collection_id: string;
                collection_name: string;
                creator_address: string;
                current_supply: any;
                description: string;
                last_transaction_timestamp: any;
                last_transaction_version: any;
                max_supply?: any;
                mutable_description?: null | boolean;
                mutable_uri?: null | boolean;
                table_handle_v1?: null | string;
                token_standard: string;
                total_minted_v2?: any;
                uri: string;
            };
            decimals?: any;
            description: string;
            is_fungible_v2?: null | boolean;
            largest_property_version_v1?: any;
            last_transaction_timestamp: any;
            last_transaction_version: any;
            maximum?: any;
            supply?: any;
            token_data_id: string;
            token_name: string;
            token_properties: any;
            token_standard: string;
            token_uri: string;
        };
        is_fungible_v2?: null | boolean;
        is_soulbound_v2?: null | boolean;
        last_transaction_timestamp: any;
        last_transaction_version: any;
        owner_address: string;
        property_version_v1: any;
        storage_id: string;
        table_type_v1?: null | string;
        token_data_id: string;
        token_properties_mutated_v1?: any;
        token_standard: string;
    }[]>

    GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddresss.

    Example

    const digitalAssets = await aptos.getOwnedDigitalAssets({ownerAddress:"0x123"})
    
  • Retrieve the owner address of a domain name or subdomain name from the contract.

    Parameters

    • args: {
          name: string;
      }
      • name: string

        A string of the name to retrieve

    Returns Promise<undefined | AccountAddress>

    AccountAddress if the name is owned, undefined otherwise

    Example

    // 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.

    Parameters

    • args: {
          derivationPath?: string;
          ephemeralKeyPair: EphemeralKeyPair;
          jwt: string;
      }
      • Optional derivationPath?: string

        a derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults to "m/44'/637'/0'/0'/0".

      • ephemeralKeyPair: EphemeralKeyPair

        the EphemeralKeyPair used to generate the nonce in the JWT token

      • jwt: string

        JWT token

    Returns Promise<Uint8Array>

    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.

    Parameters

    Returns Promise<undefined | string>

    a string if the account has a primary name, undefined otherwise

    Example

    const name = await aptos.getPrimaryName({address: alice.accountAddress})
    // name = test.aptos
  • Query the processor status for a specific processor type.

    Parameters

    Returns Promise<{
        last_success_version: any;
        last_updated: any;
        processor: string;
    }>

    Example

    const status = await aptos.getProcessorStatus({processorType:"account_transactions_processor"})
    
  • Fetches a proof from the Aptos prover service API.

    Parameters

    • args: {
          ephemeralKeyPair: EphemeralKeyPair;
          jwt: string;
          pepper?: HexInput;
          uidKey?: string;
      }
      • ephemeralKeyPair: EphemeralKeyPair

        the EphemeralKeyPair used to generate the nonce in the JWT token

      • jwt: string

        JWT token

      • Optional pepper?: HexInput

        the pepper used for the account. If not provided it will be fetched from the Aptos pepper service

      • Optional uidKey?: string

        a key in the JWT token to use to set the uidVal in the IdCommitment

    Returns Promise<ZeroKnowledgeSig>

    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.

    Parameters

    Returns Uint8Array

    Example

    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

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

    Table item value rendered in JSON

    Example

    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

    Parameters

    • args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<{
              decoded_key: any;
              decoded_value?: any;
              key: string;
              table_handle: string;
              transaction_version: any;
              write_set_change_index: any;
          }>;
      }
      • Optional minimumLedgerVersion?: AnyNumber
      • Optional options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<{
            decoded_key: any;
            decoded_value?: any;
            key: string;
            table_handle: string;
            transaction_version: any;
            write_set_change_index: any;
        }>

    Returns Promise<{
        decoded_key: any;
        decoded_value?: any;
        key: string;
        table_handle: string;
        transaction_version: any;
        write_set_change_index: any;
    }[]>

    GetTableItemsDataResponse

    Example

    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

    Parameters

    • args: {
          minimumLedgerVersion?: AnyNumber;
          options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<{
              handle: string;
              key_type: string;
              value_type: string;
          }>;
      }

    Returns Promise<{
        handle: string;
        key_type: string;
        value_type: string;
    }[]>

    GetTableItemsMetadataResponse

    Example

    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

    Parameters

    • args: {
          name: string;
      }
      • name: string

        A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.

    Returns Promise<undefined | AccountAddress>

    AccountAddress if the name has a target, undefined otherwise

    Example

    const targetAddr = await aptos.getTargetAddress({name: "test.aptos"})
    // targetAddr = 0x123...
  • Queries on-chain transaction by transaction hash. This function will return pending transactions.

    Parameters

    • args: {
          transactionHash: HexInput;
      }
      • transactionHash: HexInput

        Transaction hash should be hex-encoded bytes string with 0x prefix.

    Returns Promise<TransactionResponse>

    Transaction from mempool (pending) or on-chain (committed) transaction

    Example

    const transaction = await aptos.getTransactionByHash({transactionHash:"0x123"})
    
  • Queries on-chain transaction by version. This function will not return pending transactions.

    Parameters

    • args: {
          ledgerVersion: AnyNumber;
      }
      • ledgerVersion: AnyNumber

        Transaction version is an unsigned 64-bit number.

    Returns Promise<TransactionResponse>

    On-chain transaction. Only on-chain transactions have versions, so this function cannot be used to query pending transactions.

    Example

    const transaction = await aptos.getTransactions({ledgerVersion:1})
    
  • Defines if specified transaction is currently in pending state

    To create a transaction hash:

    1. Create a hash message from the bytes: "Aptos::Transaction" bytes + the BCS-serialized Transaction bytes.
    2. Apply hash algorithm SHA3-256 to the hash message bytes.
    3. Hex-encode the hash bytes with 0x prefix.

    Parameters

    • args: {
          transactionHash: HexInput;
      }
      • transactionHash: HexInput

        A hash of transaction

    Returns Promise<boolean>

    true if transaction is in pending state and false otherwise

    Example

    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.

    Parameters

    Returns Promise<AccountAddress>

    Promise The accountAddress associated with the authentication key

    Example

    const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})
    
  • Create a transaction to mint a digital asset into the creators account within an existing collection.

    Parameters

    • args: {
          collection: string;
          creator: Account;
          description: string;
          name: string;
          options?: InputGenerateTransactionOptions;
          propertyKeys?: string[];
          propertyTypes?: ("U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY")[];
          propertyValues?: PropertyValue[];
          uri: string;
      }
      • collection: string

        the name of the collection the digital asset belongs to

      • creator: Account

        the creator of the collection

      • description: string

        the description of the digital asset

      • name: string

        the name of the digital asset

      • Optional options?: InputGenerateTransactionOptions
      • Optional propertyKeys?: string[]
      • Optional propertyTypes?: ("U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY")[]
      • Optional propertyValues?: PropertyValue[]
      • uri: string

        the URI to additional info about the digital asset

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    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

    Parameters

    • args: {
          account: Account;
          collection: string;
          description: string;
          name: string;
          options?: InputGenerateTransactionOptions;
          propertyKeys?: string[];
          propertyTypes?: ("U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY")[];
          propertyValues?: PropertyValue[];
          recipient: AccountAddressInput;
          uri: string;
      }
      • account: Account

        The account that mints the digital asset

      • collection: string

        The collection name that the digital asset belongs to

      • description: string

        The digital asset description

      • name: string

        The digital asset name

      • Optional options?: InputGenerateTransactionOptions
      • Optional propertyKeys?: string[]

        The property keys for storing on-chain properties

      • Optional propertyTypes?: ("U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY")[]

        The type of property values

      • Optional propertyValues?: PropertyValue[]

        The property values to be stored on-chain

      • recipient: AccountAddressInput

        The account address where the digital asset will be created

      • uri: string

        The digital asset URL

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.mintSoulBoundTransaction({
    account: alice,
    collection: "collectionName",
    description: "collectionDescription",
    name: "digitalAssetName",
    uri: "digital-asset-uri.com",
    recipient: "0x123"
    });
  • Registers a new name

    Parameters

    • args: Omit<RegisterNameParameters, "aptosConfig">

    Returns Promise<SimpleTransaction>

    SimpleTransaction

    Example

    // 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

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          propertyKey: string;
          propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY";
          propertyValue: PropertyValue;
      }
      • creator: Account
      • digitalAssetAddress: AccountAddressInput

        The digital asset address

      • Optional digitalAssetType?: `${string}::${string}::${string}`
      • Optional options?: InputGenerateTransactionOptions
      • propertyKey: string

        The property key for storing on-chain properties

      • propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY"

        The type of property value

      • propertyValue: PropertyValue

        The property value to be stored on-chain

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    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.

    Parameters

    • args: {
          name: string;
          options?: InputGenerateTransactionOptions;
          sender: Account;
          years?: 1;
      }
      • name: string

        A string of the domain the subdomain will be under. The signer must be the domain owner. Subdomains cannot be renewed.

      • Optional options?: InputGenerateTransactionOptions
      • sender: Account

        The sender account

      • Optional years?: 1

        The number of years to renew the name. Currently only one year is permitted.

    Returns Promise<SimpleTransaction>

    SimpleTransaction

    Example

    await aptos.renewDomain({sender: alice, name: "test"})
    // test.apt will be renewed for one year
  • Set the digital asset description

    Parameters

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.setDigitalAssetDescriptionTransaction({
    creator: alice,
    description: "digitalAssetDescription",
    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.

    Parameters

    Returns Promise<SimpleTransaction>

    SimpleTransaction

    Example

    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

    Parameters

    Returns Promise<SimpleTransaction>

    SimpleTransaction

    Example

    await aptos.setTargetAddress({sender: alice, name: "test.aptos", address: bob.accountAddress})
    const address = await aptos.getTargetAddress({name: "test.aptos"})
    // address = bob.accountAddress
  • Sign and submit a single signer transaction to chain

    Parameters

    Returns Promise<PendingTransactionResponse>

    PendingTransactionResponse

    Example

    const transaction = await aptos.transaction.build.simple({...})
    const transaction = await aptos.signAndSubmitTransaction({
    signer: alice,
    transaction
    })
  • 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)

    Parameters

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.transferDigitalAssetTransaction({
    sender: alice,
    digitalAssetAddress: "0x123",
    recipient: "0x456",
    });
  • Update a digital asset property

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          propertyKey: string;
          propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY";
          propertyValue: PropertyValue;
      }
      • creator: Account
      • digitalAssetAddress: AccountAddressInput

        The digital asset address

      • Optional digitalAssetType?: `${string}::${string}::${string}`
      • Optional options?: InputGenerateTransactionOptions
      • propertyKey: string

        The property key for storing on-chain properties

      • propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY"

        The type of property value

      • propertyValue: PropertyValue

        The property value to be stored on-chain

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.updateDigitalAssetPropertyTransaction({
    creator: alice,
    propertyKey: "newKey",
    propertyType: "BOOLEAN",
    propertyValue: false,
    digitalAssetAddress: "0x123",
    });
  • Update a typed digital asset property

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          propertyKey: string;
          propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY";
          propertyValue: PropertyValue;
      }
      • creator: Account
      • digitalAssetAddress: AccountAddressInput

        The digital asset address

      • Optional digitalAssetType?: `${string}::${string}::${string}`
      • Optional options?: InputGenerateTransactionOptions
      • propertyKey: string

        The property key for storing on-chain properties

      • propertyType: "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "BOOLEAN" | "ADDRESS" | "STRING" | "ARRAY"

        The type of property value

      • propertyValue: PropertyValue

        The property value to be stored on-chain

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to chain

    Example

    const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({
    creator: alice,
    propertyKey: "typedKey",
    propertyType: "U8",
    propertyValue: 2,
    digitalAssetAddress: "0x123",
    });
  • Waits for a transaction to move past the pending state.

    There are 4 cases.

    1. Transaction is successfully processed and committed to the chain.
      • The function will resolve with the transaction response from the API.
    2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.
      • The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.
    3. Transaction is committed but execution failed, meaning no changes were written to the blockchain state.
      • If 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.
    4. Transaction does not move past the pending state within args.options.timeoutSecs seconds.
      • The function will throw a WaitForTransactionError

    Parameters

    Returns Promise<CommittedTransactionResponse>

    The transaction on-chain. See above for more details.

    Example

    const transaction = await aptos.waitForTransaction({transactionHash:"0x123"})