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.

Hierarchy

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

Constructors

Properties

Methods

addDigitalAssetPropertyTransaction addDigitalAssetTypedPropertyTransaction batchTransactionsForSingleAccount burnDigitalAssetTransaction createCollectionTransaction deriveAccountFromPrivateKey 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 getPrimaryName getProcessorStatus getSigningMessage getTableItem 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
staking: Staking
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

  • 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

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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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"
    }
  • 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

  • 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

  • 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

  • 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: An example of an account resource

    {
    value: 6
    }
  • 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

  • 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

  • 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

  • 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

  • Queries for the chain id

    Returns Promise<number>

    The chain id

  • Queries top user transactions

    Parameters

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

        The number of transactions to return

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

    GetChainTopUserTransactionsResponse

  • 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

  • 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

  • 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

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

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

    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

  • 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

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

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

  • 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

    { where:
    {
    transaction_version: { _eq: 123456 },
    }
    }
  • Retrieve the expiration time of a domain name or subdomain name from the contract.

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

    Parameters

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

        A string of the name to retrieve

    Returns Promise<undefined | number>

    number as a unix timestamp in milliseconds.

  • Queries all fungible asset activities

    Parameters

    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

  • Queries all fungible asset metadata.

    Parameters

    Returns Promise<{
        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;
    }[]>

    A list of fungible asset metadata

  • 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;
        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;
    }>

    A fungible asset metadata item

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

  • Queries for the Aptos ledger info

    Returns Promise<LedgerInfo>

    Aptos Ledger Info

    Example: 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

  • 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

  • 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

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

  • Retrieve the owner address of a domain name or subdomain name from the contract.

    // Will return the owner address of "test.aptos.apt" or undefined
    const owner = await aptos.getOwnerAddress({name: "test.aptos"})
    // owner = 0x123...

    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

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

    const name = await aptos.getPrimaryName({address: alice.accountAddress})
    // name = test.aptos

    Parameters

    Returns Promise<undefined | string>

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

  • Query the processor status for a specific processor type.

    Parameters

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

  • 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

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

    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
    {
    data.key_type = "address" // Move type of table key
    data.value_type = "u128" // Move type of table value
    data.key = "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key
    }
  • 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

    const targetAddr = await aptos.getTargetAddress({name: "test.aptos"})
    // targetAddr = 0x123...

    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

  • 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

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

  • 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

  • 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

  • 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: AccountAddress;
          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: AccountAddress

        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

  • Registers a new name

    // 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,
    },
    });

    Parameters

    • args: Omit<RegisterNameParameters, "aptosConfig">

    Returns Promise<SimpleTransaction>

    SimpleTransaction

  • 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

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

    await aptos.renewDomain({sender: alice, name: "test"})
    // test.apt will be renewed for one year

    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

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

    await aptos.setPrimaryName({sender: alice, name: "test.aptos"})
    const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})
    // primaryName = test.aptos

    Parameters

    Returns Promise<SimpleTransaction>

    SimpleTransaction

  • 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

    await aptos.setTargetAddress({sender: alice, name: "test.aptos", address: bob.accountAddress})
    const address = await aptos.getTargetAddress({name: "test.aptos"})
    // address = bob.accountAddress

    Parameters

    Returns Promise<SimpleTransaction>

    SimpleTransaction

  • 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

  • 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

  • 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

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

Generated using TypeDoc