Class Arc3

Class representing an ARC-3 compliant NFT on Algorand. Extends CoreAsset with metadata handling for the ARC-3 standard.

Hierarchy (view full)

Constructors

  • Creates an instance of Arc3.

    Parameters

    • id: number

      The asset ID

    • params: AssetParams

      The asset parameters from the Algorand blockchain

    • metadata: object

      The metadata associated with the asset

    Returns Arc3

Properties

assetParams: AssetParams

The asset parameters retrieved from the Algorand blockchain

id: number

The asset ID on the Algorand blockchain

metadata: object

The metadata associated with this ARC-3 asset

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 freeze address of the asset

    Returns string

    The freeze address or the zero address if not set

  • Gets the manager address of the asset

    Returns string

    The manager address or the zero address if not set

  • Gets the metadata associated with the asset

    Returns object

    The metadata object

  • Gets the reserve address of the asset

    Returns string

    The reserve address or the zero address if not set

  • 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 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 has a valid ARC-3 name

    Returns boolean

    True if the asset name is ARC-3 compliant

  • Checks if the asset has a valid ARC-3 URL

    Returns boolean

    True if the asset URL is ARC-3 compliant

  • Checks if the asset is ARC-3 compliant

    Returns boolean

    True if the asset is ARC-3 compliant

  • Private

    Calculates the SHA256 hash of a file's content

    Parameters

    • blobContent: undefined | Blob

      The file content as a Blob

    Returns Promise<string>

    A promise resolving to the hex-encoded hash

  • Creates a new ARC-3 compliant NFT on the Algorand blockchain

    Parameters

    • options: {
          clawback?: string;
          creator: {
              address: string;
              signer: TransactionSigner;
          };
          defaultFrozen?: boolean;
          freeze?: string;
          image: string;
          imageName: string;
          ipfs: IPFS;
          manager?: string;
          name: string;
          network: Network;
          properties: object;
          reserve?: string;
          unitName: string;
      }

      The configuration options for the NFT

      • Optional clawback?: string

        The clawback address

      • creator: {
            address: string;
            signer: TransactionSigner;
        }

        The creator of the asset, including address and signer

        • address: string
        • signer: TransactionSigner
      • Optional defaultFrozen?: boolean

        Whether the asset should be frozen by default

      • Optional freeze?: string

        The freeze address

      • image: string

        The path to the image file

      • imageName: string

        The name of the image file

      • ipfs: IPFS

        The IPFS instance to use for uploading

      • Optional manager?: string

        The manager address

      • name: string

        The name of the asset

      • network: Network

        The Algorand network to use

      • properties: object

        Additional properties to include in the metadata

      • Optional reserve?: string

        The reserve address

      • unitName: string

        The unit name for the asset

    Returns Promise<{
        assetId: undefined | bigint;
        txid: string;
    }>

    A promise resolving to an object containing the transaction ID and asset ID

  • 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

  • Fetches metadata from a given URL

    Parameters

    • url: string

      The URL to fetch metadata from

    Returns Promise<object>

    A promise resolving to the metadata object

  • Creates an Arc3 instance from an existing asset ID

    Parameters

    • id: number

      The asset ID to load

    • network: Network

      The Algorand network to use

    Returns Promise<Arc3>

    A promise resolving to an Arc3 instance

  • Resolves URLs, handling IPFS protocol and ID replacements

    Parameters

    • url: string

      The URL to resolve

    • id: number

      The asset ID to replace in the URL if needed

    Returns string

    The resolved URL