Class Arc69

Class representing an ARC-69 compliant NFT on Algorand. ARC-69 NFTs store metadata in transaction notes rather than external URLs. Extends CoreAsset with metadata handling for the ARC-69 standard.

Hierarchy (view full)

Constructors

  • Creates an instance of Arc69.

    Parameters

    • id: number

      The asset ID on the Algorand blockchain

    • params: AssetParams

      The asset parameters from the Algorand blockchain

    • network: Network

      The Algorand network this asset exists on

    • metadata: any

      The metadata associated with the asset (from transaction notes)

    Returns Arc69

Properties

assetParams: AssetParams

The asset parameters retrieved from the Algorand blockchain

id: number

The asset ID on the Algorand blockchain

metadata: any

The metadata associated with this ARC-69 asset, stored in transaction notes

network: Network

The Algorand network to use

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 image as a base64 encoded string

    Returns Promise<string>

    A promise resolving to the base64 encoded image

  • Gets the resolved image URL for this ARC-69 asset

    Returns string

    The resolved image URL

  • Gets the manager address of the asset

    Returns string

    The manager address or the zero address if not set

  • Gets the metadata associated with this ARC-69 asset

    Returns any

    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

  • 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-69 compliant NFT on the Algorand blockchain

    Parameters

    • options: {
          clawback?: string;
          creator: {
              address: string;
              signer: TransactionSigner;
          };
          decimals?: number;
          defaultFrozen?: boolean;
          freeze?: string;
          image: {
              file: string | File;
              name: string;
          };
          ipfs: IPFS;
          manager?: string;
          name: string;
          network: Network;
          properties: any;
          reserve?: string;
          total?: number;
          unitName: string;
      }

      Configuration options for creating the ARC-69 NFT

      • Optional clawback?: string

        The clawback address for the asset

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

        The creator account with address and transaction signer

        • address: string
        • signer: TransactionSigner
      • Optional decimals?: number

        The number of decimal places for the asset

      • Optional defaultFrozen?: boolean

        Whether the asset should be frozen by default

      • Optional freeze?: string

        The freeze address for the asset

      • image: {
            file: string | File;
            name: string;
        }

        Image file and metadata

        • file: string | File
        • name: string
      • ipfs: IPFS

        IPFS instance for uploading the image

      • Optional manager?: string

        The manager address for the asset

      • name: string

        The name of the NFT

      • network: Network

        The Algorand network to create the NFT on

      • properties: any

        Additional properties for the NFT metadata

      • Optional reserve?: string

        The reserve address for the asset

      • Optional total?: number

        The total number of units to create

      • unitName: string

        The unit name for the NFT

    Returns Promise<{
        assetId: number;
        transactionId: 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 ARC-69 metadata from transaction notes for a given asset

    Parameters

    • assetId: number

      The asset ID to fetch metadata for

    • network: Network

      The Algorand network to search on

    Returns Promise<any>

    A promise resolving to the metadata object, or undefined if not found

  • Creates an Arc69 instance from existing asset parameters

    Parameters

    • id: number

      The asset ID

    • assetParams: AssetParams

      The asset parameters from the blockchain

    • network: Network

      The Algorand network to use

    Returns Promise<Arc69>

    A promise resolving to an Arc69 instance

  • Creates an Arc69 instance from an existing asset ID

    Parameters

    • id: number

      The asset ID to load

    • network: Network

      The Algorand network to use

    Returns Promise<Arc69>

    A promise resolving to an Arc69 instance

  • Retrieves all historical versions of metadata for an ARC-69 asset

    Parameters

    • assetId: number

      The asset ID to get metadata versions for

    • network: Network

      The Algorand network to search on

    Returns Promise<Record<string, any>[]>

    A promise resolving to an array of metadata objects

  • Checks if an asset has valid ARC-69 metadata in its transaction notes

    Parameters

    • assetId: number

      The asset ID to check

    • network: Network

      The Algorand network to search on

    Returns Promise<boolean>

    True if the asset has valid ARC-69 metadata

  • Validates if a URL conforms to ARC-69 standards

    Parameters

    • url: string

      The URL to validate

    Returns boolean

    True if the URL is valid for ARC-69

  • Determines if an asset is ARC-69 compliant

    Parameters

    • url: string

      The asset URL to check

    • id: number

      The asset ID

    • network: Network

      The Algorand network to check on

    Returns Promise<boolean>

    True if the asset is ARC-69 compliant

  • Resolves standard URLs, handling HTTP/HTTPS and IPFS protocols

    Parameters

    • url: string

      The URL to resolve

    Returns string

    The resolved URL with proper protocol

  • Public method to resolve URLs for ARC-69 assets

    Parameters

    • url: string

      The URL to resolve

    Returns string

    The resolved URL

  • Updates the metadata properties of an existing ARC-69 NFT

    Parameters

    • options: {
          assetId: number;
          manager: {
              address: string;
              signer: TransactionSigner;
          };
          network: Network;
          properties: any;
      }

      Configuration options for updating the NFT metadata

      • assetId: number

        The asset ID of the NFT to update

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

        The manager account with address and transaction signer

        • address: string
        • signer: TransactionSigner
      • network: Network

        The Algorand network the NFT exists on

      • properties: any

        The new properties to set in the metadata

    Returns Promise<{
        confirmedRound: undefined | bigint;
        transactionId: string;
    }>

    A promise resolving to an object containing the transaction ID and confirmed round