Class SubtopiaRegistryClient

SubtopiaRegistryClient is a class that provides methods to interact with the Subtopia Registry contract. It provides methods to create, update and delete products and lockers in the registry.

Constructors

  • Parameters

    • __namedParameters: {
          algodClient: AlgodClient;
          appAddress: string;
          appID: number;
          appSpec: ApplicationSpec;
          creator: TransactionSignerAccount;
          oracleID: number;
          timeout: number;
          version: string;
      }
      • algodClient: AlgodClient
      • appAddress: string
      • appID: number
      • appSpec: ApplicationSpec
      • creator: TransactionSignerAccount
      • oracleID: number
      • timeout: number
      • version: string

    Returns SubtopiaRegistryClient

Properties

algodClient: AlgodClient
appAddress: string
appID: number
creator: TransactionSignerAccount
oracleID: number
timeout: number
version: string

Methods

  • This method is used to create a new locker. The locker creation fee is calculated and paid by the creator. The method returns the transaction ID and the locker ID.

    Parameters

    Returns Promise<{
        lockerID: number;
        txID: string;
    }>

    A promise that resolves to an object containing the transaction ID and the locker ID.

  • This method is used to create a new product. The method returns the transaction ID and the product ID.

    Parameters

    Returns Promise<{
        productID: number;
        txID: string;
    }>

    A promise that resolves to an object containing the transaction ID and the product ID.

  • This method is used to delete a product. The method returns the transaction ID.

    Parameters

    Returns Promise<{
        txID: string;
    }>

    A promise that resolves to an object containing the transaction ID.

  • This method is used to calculate the locker creation fee. The fee is calculated by adding the minimum application creation member, the locker creation member, and the registry locker box creation member.

    Parameters

    • creatorAddress: string

      The address of the creator.

    Returns number

    The locker creation fee.

  • This method is used to calculate the locker transfer fee. The fee is calculated by adding the minimum application opt-in member, and if the coinID is provided, the minimum ASA opt-in member. If the locker is new, the locker creation fee is also added.

    Parameters

    • creatorAddress: string

      The address of the creator.

    • isNewLocker: boolean

      Whether the locker is new.

    • coinID: number

      The ID of the coin.

    Returns number

    The locker transfer fee.

  • This method is used to get the latest available locker contract version. Can be used to check if the current locker instance is up to date.

    Returns Promise<string>

    A promise that resolves to the locker version.

  • This method is used to calculate the product creation fee. The fee is calculated based on the minimum balance requirements for creating and opting into an application, and the minimum balance requirement for creating a product. If a coinID is provided, the minimum balance requirement for opting into an ASA is also added to the fee.

    Parameters

    • coinID: number = 0

      The ID of the coin. If provided, the minimum balance requirement for opting into an ASA is added to the fee.

    Returns Promise<number>

    A promise that resolves to the product creation fee in microAlgos.

  • This method is used to calculate the product creation platform fee. The fee is always returns in microAlgos equivalent to the current price of Algo in cents.

    Returns Promise<number>

    A promise that resolves to the product creation platform fee in microAlgos.

  • This method is used to get the latest available product contract version. Can be used to check if the current product instance is up to date.

    Parameters

    Returns Promise<string>

    A promise that resolves to the product version.

  • This method is used to transfer a product from one owner to another. The method returns the transaction ID of the transfer.

    Parameters

    Returns Promise<{
        txID: string;
    }>

    A promise that resolves to an object containing the transaction ID.

  • This method initializes a new instance of the SubtopiaRegistryClient class using the provided parameters.

    Parameters

    Returns Promise<SubtopiaRegistryClient>

    A new instance of the SubtopiaRegistryClient class initialized with the provided parameters.

    import { ChainType, SubtopiaRegistryClient } from "subtopia-js-sdk";

    const registryClient = await SubtopiaRegistryClient.init({
    algodClient: algodClient,
    creator: creator,
    chainType: ChainType.TESTNET
    });