Class CoreAsset

Base class for working with Algorand Standard Assets (ASAs) Provides core functionality for interacting with assets on the Algorand blockchain

Hierarchy (view full)

Constructors

  • Creates an instance of CoreAsset

    Parameters

    • id: number

      The asset ID

    • assetParams: AssetParams

      The asset parameters

    Returns CoreAsset

Properties

assetParams: AssetParams

The asset parameters retrieved from the Algorand blockchain

id: number

The asset ID on the Algorand blockchain

Methods

  • Gets the asset parameters

    Returns AssetParams

    The asset parameters

  • Converts an amount from decimal-adjusted units to base units

    Parameters

    • amount: number

      The amount in decimal-adjusted units

    Returns number

    The amount in base units

  • Converts an amount from base units to decimal-adjusted units

    Parameters

    • amount: number

      The amount in base units

    Returns number

    The amount adjusted for decimals

  • Gets the clawback address of the asset

    Returns string

    The clawback address or the zero address if not set

  • Gets the creator address of the asset

    Returns string

    The creator address

  • Gets the asset decimals

    Returns number

    The number of decimals for the asset

  • Gets whether the asset is frozen by default

    Returns boolean

    True if the asset is frozen by default

  • Gets the freeze address of the asset

    Returns string

    The freeze address or the zero address if not set

  • Gets the asset ID

    Returns number

    The asset ID

  • Gets the manager address of the asset

    Returns string

    The manager address or the zero address if not set

  • Gets the asset metadata hash

    Returns string

    The metadata hash as a string

  • Gets the asset name

    Returns string

    The asset name or empty string if not set

  • Gets the reserve address of the asset

    Returns string

    The reserve address or the zero address if not set

  • Gets the total supply in base units

    Returns number

    The total supply in base units

  • Gets the total supply adjusted for decimals

    Returns number

    The total supply adjusted for decimals

  • Gets the asset unit name

    Returns string

    The asset unit name or empty string if not set

  • Gets the asset URL

    Returns string

    The asset URL or empty string if not set

  • Gets the protocol part of the asset URL

    Returns string

    The URL protocol or empty string if not found

  • Checks if the asset has a clawback address

    Returns boolean

    True if the asset has a clawback address

  • Checks if the asset has a freeze address

    Returns boolean

    True if the asset has a freeze address

  • Checks if the asset URL uses HTTP or HTTPS protocol

    Returns boolean

    True if the URL uses HTTP or HTTPS

  • Checks if the asset URL uses IPFS protocol

    Returns boolean

    True if the URL uses IPFS

  • Checks if the asset has a manager address

    Returns boolean

    True if the asset has a manager address

  • Checks if the asset has a reserve address

    Returns boolean

    True if the asset has a reserve address

  • Checks if the asset URL uses template-ipfs protocol

    Returns boolean

    True if the URL uses template-ipfs

  • Fetches asset parameters from the Algorand blockchain

    Parameters

    • id: number

      The asset ID to fetch

    • network: Network

      The Algorand network to use

    Returns Promise<AssetParams>

    A promise resolving to the asset parameters

  • Creates a CoreAsset instance from an asset ID

    Parameters

    • id: number

      The asset ID to load

    • network: Network

      The Algorand network to use

    Returns Promise<CoreAsset>

    A promise resolving to a CoreAsset instance