A class to query all DigitalAsset related queries on Aptos.

Hierarchy (View Summary)

DigitalAsset

  • Initializes a new instance of the Aptos client with the specified configuration. This allows you to interact with the Aptos blockchain using the provided settings.

    Parameters

    • config: AptosConfig

      The configuration settings for the Aptos client.

    Returns DigitalAsset

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    async function runExample() {
    // Create a configuration for the Aptos client
    const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network

    // Initialize the Aptos client with the configuration
    const aptos = new Aptos(config);

    console.log("Aptos client initialized:", aptos);
    }
    runExample().catch(console.error);
  • Add a digital asset property to the blockchain. This function allows you to specify a new property for a digital asset, including its key, type, and value.

    Parameters

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

      The arguments for adding a digital asset property.

      • creator: Account

        The account that mints the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The digital asset address.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        (Optional) The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        (Optional) Options for generating the transaction.

      • propertyKey: string

        The property key for storing on-chain properties.

      • propertyType:
            | "BOOLEAN"
            | "U8"
            | "U16"
            | "U32"
            | "U64"
            | "U128"
            | "U256"
            | "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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Add a digital asset property
    const transaction = await aptos.addDigitalAssetPropertyTransaction({
    creator: Account.generate(), // Replace with a real account
    propertyKey: "newKey",
    propertyType: "BOOLEAN",
    propertyValue: true,
    digitalAssetAddress: "0x123", // Replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Add a typed digital asset property to the blockchain. This function allows you to define and store a specific property for a digital asset, enabling better categorization and management of digital assets.

    Parameters

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

      The parameters for adding the typed property.

      • creator: Account

        The account that mints the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The digital asset address.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        The optional type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional transaction generation options.

      • propertyKey: string

        The property key for storing on-chain properties.

      • propertyType:
            | "BOOLEAN"
            | "U8"
            | "U16"
            | "U32"
            | "U64"
            | "U128"
            | "U256"
            | "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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Adding a typed digital asset property
    const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({
    creator: Account.generate(), // replace with a real account
    propertyKey: "typedKey",
    propertyType: "STRING",
    propertyValue: "hello",
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Burn a digital asset by its creator, allowing for the removal of a specified digital asset from the blockchain.

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
      }

      The arguments for burning the digital asset.

      • creator: Account

        The creator account that is burning the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset to be burned.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset being burned.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    const creator = Account.generate(); // Replace with a real creator account
    const transaction = await aptos.burnDigitalAssetTransaction({
    creator: creator,
    digitalAssetAddress: "0x123", // Replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Creates a new collection within the specified account.

    Parameters

    • args: {
          creator: Account;
          description: string;
          name: string;
          options?: InputGenerateTransactionOptions;
          uri: string;
      } & CreateCollectionOptions
      • creator: Account

        The account of the collection's creator.

      • description: string

        The description of the collection.

      • name: string

        The name of the collection.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional parameters for generating the transaction.

        The parameters below are optional:

      • uri: string

        The URI to additional info about the collection.

      Options for creating a collection, allowing customization of various attributes such as supply limits, mutability of metadata, and royalty settings.

      • OptionalmaxSupply?: AnyNumber
      • OptionalmutableDescription?: boolean
      • OptionalmutableRoyalty?: boolean
      • OptionalmutableTokenDescription?: boolean
      • OptionalmutableTokenName?: boolean
      • OptionalmutableTokenProperties?: boolean
      • OptionalmutableTokenURI?: boolean
      • OptionalmutableURI?: boolean
      • OptionalroyaltyDenominator?: number
      • OptionalroyaltyNumerator?: number
      • OptionaltokensBurnableByCreator?: boolean
      • OptionaltokensFreezableByCreator?: boolean

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that when submitted will create the collection.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Creating a new collection transaction
    const transaction = await aptos.createCollectionTransaction({
    creator: Account.generate(), // Replace with a real account
    description: "A unique collection of digital assets.",
    name: "My Digital Collection",
    uri: "https://mycollection.com",
    });

    console.log("Transaction created:", transaction);
    }
    runExample().catch(console.error);
  • Freeze the ability to transfer a specified digital asset. This function allows the creator to restrict the transfer capability of a digital asset.

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
      }

      The arguments for freezing the digital asset transfer.

      • creator: Account

        The creator account initiating the freeze.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset to be frozen.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset being frozen.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Freeze the digital asset transfer
    const transaction = await aptos.freezeDigitalAssetTransaferTransaction({
    creator: Account.generate(), // Replace with a real account if needed
    digitalAssetAddress: "0x123", // Replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Queries data of a specific collection by the collection creator address and the collection name. This function is deprecated; use getCollectionDataByCreatorAddressAndCollectionName instead.

    If a creator account has two collections with the same name in v1 and v2, you can pass an optional tokenStandard parameter to query a specific standard.

    Parameters

    • args: {
          collectionName: string;
          creatorAddress: AccountAddressInput;
          minimumLedgerVersion?: AnyNumber;
          options?: TokenStandardArg;
      }

      The arguments for querying the collection data.

      • collectionName: string

        The name of the collection.

      • creatorAddress: AccountAddressInput

        The address of the collection's creator.

      • OptionalminimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to before querying.

      • Optionaloptions?: TokenStandardArg

        Optional parameters for the query.

    Returns Promise<
        {
            cdn_asset_uris?: | null
            | {
                animation_optimizer_retry_count: number;
                asset_uri: string;
                cdn_animation_uri?: null
                | string;
                cdn_image_uri?: null | string;
                cdn_json_uri?: null | string;
                image_optimizer_retry_count: number;
                json_parser_retry_count: number;
                raw_animation_uri?: null | string;
                raw_image_uri?: null | string;
            };
            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 - The response type containing the collection data.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Querying collection data by creator address and collection name
    const collection = await aptos.getCollectionData({
    creatorAddress: "0x1", // replace with a real creator address
    collectionName: "myCollection", // specify your collection name
    });

    console.log(collection);
    }
    runExample().catch(console.error);
  • Queries data of a specific collection by the collection ID.

    Parameters

    Returns Promise<
        {
            cdn_asset_uris?: | null
            | {
                animation_optimizer_retry_count: number;
                asset_uri: string;
                cdn_animation_uri?: null
                | string;
                cdn_image_uri?: null | string;
                cdn_json_uri?: null | string;
                image_optimizer_retry_count: number;
                json_parser_retry_count: number;
                raw_animation_uri?: null | string;
                raw_image_uri?: null | string;
            };
            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 - The response type containing the collection data.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fetching collection data by collection ID
    const collection = await aptos.getCollectionDataByCollectionId({
    collectionId: "0x123", // replace with a real collection ID
    });

    console.log(collection);
    }
    runExample().catch(console.error);
  • Retrieves data for a specific collection created by a given creator address. This function allows you to query collection data while optionally specifying a minimum ledger version and pagination options.

    Parameters

    Returns Promise<
        {
            cdn_asset_uris?: | null
            | {
                animation_optimizer_retry_count: number;
                asset_uri: string;
                cdn_animation_uri?: null
                | string;
                cdn_image_uri?: null | string;
                cdn_json_uri?: null | string;
                image_optimizer_retry_count: number;
                json_parser_retry_count: number;
                raw_animation_uri?: null | string;
                raw_image_uri?: null | string;
            };
            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 - The response type containing collection data.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Retrieve collection data by creator address
    const collectionData = await aptos.getCollectionDataByCreatorAddress({
    creatorAddress: "0x1", // replace with a real creator address
    minimumLedgerVersion: 1, // specify the minimum ledger version if needed
    options: {
    tokenStandard: "v2", // specify the token standard if needed
    pagination: { limit: 10, offset: 0 } // specify pagination options if needed
    }
    });

    console.log(collectionData);
    }
    runExample().catch(console.error);
  • Queries data of a specific collection by the collection creator address and the collection name. If a creator account has multiple collections with the same name across different versions, specify the tokenStandard parameter to query a specific standard.

    Parameters

    Returns Promise<
        {
            cdn_asset_uris?: | null
            | {
                animation_optimizer_retry_count: number;
                asset_uri: string;
                cdn_animation_uri?: null
                | string;
                cdn_image_uri?: null | string;
                cdn_json_uri?: null | string;
                image_optimizer_retry_count: number;
                json_parser_retry_count: number;
                raw_animation_uri?: null | string;
                raw_image_uri?: null | string;
            };
            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 - The response type containing collection data.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fetching collection data by creator address and collection name
    const collection = await aptos.getCollectionDataByCreatorAddressAndCollectionName({
    creatorAddress: "0x1", // replace with a real creator address
    collectionName: "myCollection",
    minimumLedgerVersion: 1, // optional, specify if needed
    options: { tokenStandard: "v2" } // optional, specify if needed
    });

    console.log(collection);
    }
    runExample().catch(console.error);
  • Queries the ID of a specified collection. This ID corresponds to the collection's object address in V2, while V1 does not utilize objects and lacks an address.

    Parameters

    Returns Promise<string>

    The collection ID.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fetching the collection ID for a specific creator and collection name
    const collectionId = await aptos.getCollectionId({
    creatorAddress: "0x1", // replace with a real creator address
    collectionName: "myCollection"
    });

    console.log("Collection ID:", collectionId);
    }
    runExample().catch(console.error);
  • Retrieves the current ownership data of a specified digital asset using its address.

    Parameters

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

      The parameters for the request.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionalminimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to before querying.

    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.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Getting the current ownership of a digital asset
    const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(digitalAssetOwner);
    }
    runExample().catch(console.error);
  • Retrieves the activity data for a specified digital asset using its address.

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

      The parameters for the request.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionalminimumLedgerVersion?: AnyNumber

        Optional minimum ledger version to sync up to before querying.

      • Optionaloptions?: 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;
            },
        >

        Optional pagination and ordering parameters.

    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;
        }[],
    >

    A promise that resolves to the activity data related to the digital asset.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Get the activity data for a digital asset
    const digitalAssetActivity = await aptos.getDigitalAssetActivity({
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(digitalAssetActivity);
    }
    runExample().catch(console.error);
  • Retrieves digital asset data using the address of a digital asset.

    Parameters

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

      The parameters for the request.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionalminimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to before querying.

    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 for the digital asset.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fetching digital asset data for a specific address
    const digitalAsset = await aptos.getDigitalAssetData({
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(digitalAsset);
    }
    runExample().catch(console.error);
  • Retrieves the digital assets owned by a specified address.

    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;
      }
      • OptionalminimumLedgerVersion?: AnyNumber

        Optional ledger version to sync up to before querying.

      • Optionaloptions?: 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;
            },
        >

        Optional pagination and ordering parameters for the response.

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

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Fetching the digital assets owned by the specified address
    const digitalAssets = await aptos.getOwnedDigitalAssets({
    ownerAddress: "0x1", // replace with a real account address
    });

    console.log(digitalAssets);
    }
    runExample().catch(console.error);
  • Create a transaction to mint a digital asset into the creator's account within an existing collection. This function helps you generate a transaction that can be simulated or submitted to the blockchain for minting a digital asset.

    Parameters

    • args: {
          collection: string;
          creator: Account;
          description: string;
          name: string;
          options?: InputGenerateTransactionOptions;
          propertyKeys?: string[];
          propertyTypes?: (
              | "BOOLEAN"
              | "U8"
              | "U16"
              | "U32"
              | "U64"
              | "U128"
              | "U256"
              | "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.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional transaction generation options.

      • OptionalpropertyKeys?: string[]

        Optional array of property keys for the digital asset.

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

        Optional array of property types for the digital asset.

      • OptionalpropertyValues?: PropertyValue[]

        Optional array of property values for the digital asset.

      • uri: string

        The URI to additional info about the digital asset.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Creating a transaction to mint a digital asset
    const transaction = await aptos.mintDigitalAssetTransaction({
    creator: Account.generate(), // replace with a real account
    collection: "MyCollection",
    description: "This is a digital asset.",
    name: "MyDigitalAsset",
    uri: "https://example.com/my-digital-asset",
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Mint a soul bound digital asset into a recipient's account. This function allows you to create a unique digital asset that is bound to a specific account.

    Parameters

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

      The arguments for minting the soul bound transaction.

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

      • Optionaloptions?: InputGenerateTransactionOptions

        Additional options for generating the transaction.

      • OptionalpropertyKeys?: string[]

        The property keys for storing on-chain properties.

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

        The type of property values.

      • OptionalpropertyValues?: 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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Mint a soul bound digital asset
    const transaction = await aptos.mintSoulBoundTransaction({
    account: Account.generate(), // Replace with a real account
    collection: "collectionName",
    description: "collectionDescription",
    name: "digitalAssetName",
    uri: "digital-asset-uri.com",
    recipient: "0x123" // Replace with a real recipient account address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Remove a digital asset property from the blockchain. This function allows you to delete an existing property associated with a digital asset.

    Parameters

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

      The parameters required to remove the digital asset property.

      • creator: Account

        The account that mints the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The digital asset address.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

      • propertyKey: string

        The property key for storing on-chain properties.

      • propertyType:
            | "BOOLEAN"
            | "U8"
            | "U16"
            | "U32"
            | "U64"
            | "U128"
            | "U256"
            | "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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Remove a digital asset property
    const transaction = await aptos.removeDigitalAssetPropertyTransaction({
    creator: Account.generate(), // replace with a real account
    propertyKey: "newKey",
    propertyType: "BOOLEAN",
    propertyValue: true,
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Set the digital asset description to provide additional context or information about the asset.

    Parameters

    • args: {
          creator: Account;
          description: string;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
      }

      The parameters for setting the digital asset description.

      • creator: Account

        The creator account responsible for the digital asset.

      • description: string

        The digital asset description to be set.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Set the digital asset description
    const transaction = await aptos.setDigitalAssetDescriptionTransaction({
    creator: Account.generate(), // replace with a real account
    description: "This is a digital asset description.",
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Set the digital asset name, allowing you to define a name for a specific digital asset on the blockchain.

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          name: string;
          options?: InputGenerateTransactionOptions;
      }

      The parameters for setting the digital asset name.

      • creator: Account

        The creator account responsible for the transaction.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset, represented as a Move struct ID.

      • name: string

        The desired name for the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the blockchain.

    import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    const creator = Account.generate(); // Generate a new account for the creator
    const digitalAssetAddress = "0x123"; // replace with a real digital asset address

    // Set the digital asset name
    const transaction = await aptos.setDigitalAssetNameTransaction({
    creator: creator,
    name: "digitalAssetName",
    digitalAssetAddress: digitalAssetAddress,
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Set the URI for a digital asset, allowing you to associate a unique identifier with the asset.

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          uri: string;
      }

      The parameters for the transaction.

      • creator: Account

        The creator account initiating the transaction.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

      • uri: string

        The digital asset URI to be set.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Set the URI for a digital asset
    const transaction = await aptos.setDigitalAssetURITransaction({
    creator: Account.generate(), // Replace with a real creator account
    uri: "digital-asset-uri.com",
    digitalAssetAddress: "0x123", // Replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Transfer ownership of a non-fungible digital asset. This function allows you to transfer a digital asset only if it is not frozen, meaning the ownership transfer is not disabled.

    Parameters

    • args: {
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
          recipient: AccountAddress;
          sender: Account;
      }

      The arguments for transferring the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset being transferred.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset, defaults to "0x4::token::Token".

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

      • recipient: AccountAddress

        The account address of the recipient.

      • sender: Account

        The sender account of the current digital asset owner.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Transfer a digital asset
    const transaction = await aptos.transferDigitalAssetTransaction({
    sender: Account.generate(), // replace with a real sender account
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    recipient: "0x456", // replace with a real recipient account address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Unfreeze the ability to transfer a digital asset. This function allows the specified creator account to unfreeze the transfer of a digital asset identified by its address.

    Parameters

    • args: {
          creator: Account;
          digitalAssetAddress: AccountAddressInput;
          digitalAssetType?: `${string}::${string}::${string}`;
          options?: InputGenerateTransactionOptions;
      }

      The parameters for unfreezing the digital asset transfer.

      • creator: Account

        The creator account that is unfreezing the digital asset transfer.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset to unfreeze.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset being unfrozen.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

    Returns Promise<SimpleTransaction>

    A SimpleTransaction that can be simulated or submitted to the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Unfreeze the ability to transfer a digital asset
    const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({
    creator: Account.generate(), // replace with a real creator account
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Update a digital asset property on-chain.

    Parameters

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

      The parameters for updating the digital asset property.

      • creator: Account

        The account that mints the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The address of the digital asset.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        Optional. The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        Optional. Additional options for generating the transaction.

      • propertyKey: string

        The property key for storing on-chain properties.

      • propertyType:
            | "BOOLEAN"
            | "U8"
            | "U16"
            | "U32"
            | "U64"
            | "U128"
            | "U256"
            | "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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Update a digital asset property
    const transaction = await aptos.updateDigitalAssetPropertyTransaction({
    creator: Account.generate(), // replace with a real account
    propertyKey: "newKey",
    propertyType: "BOOLEAN",
    propertyValue: false,
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);
  • Update a typed digital asset property on-chain. This function allows you to modify the properties of a digital asset, enabling dynamic updates to its attributes.

    Parameters

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

      The arguments for updating the digital asset property.

      • creator: Account

        The account that mints the digital asset.

      • digitalAssetAddress: AccountAddressInput

        The digital asset address.

      • OptionaldigitalAssetType?: `${string}::${string}::${string}`

        (Optional) The type of the digital asset.

      • Optionaloptions?: InputGenerateTransactionOptions

        (Optional) Additional options for generating the transaction.

      • propertyKey: string

        The property key for storing on-chain properties.

      • propertyType:
            | "BOOLEAN"
            | "U8"
            | "U16"
            | "U32"
            | "U64"
            | "U128"
            | "U256"
            | "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 the chain.

    import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

    const config = new AptosConfig({ network: Network.TESTNET });
    const aptos = new Aptos(config);

    async function runExample() {
    // Update a typed digital asset property
    const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({
    creator: Account.generate(), // replace with a real account
    propertyKey: "typedKey",
    propertyType: "U8",
    propertyValue: 2,
    digitalAssetAddress: "0x123", // replace with a real digital asset address
    });

    console.log(transaction);
    }
    runExample().catch(console.error);

Properties

config: AptosConfig

The configuration settings for the Aptos client.

MMNEPVFCICPMFPCPTTAAATR