Create a Collection


The package is designed to help projects or developers create, manage, and deploy collections. It also facilitates the creation of a marketplace, interaction with xNFTs, and payment for computing, amongst others.

This documentation provides the required application programming interface (API) calls to create your collection of xNFTs. It is divided into two sections:

  1. The types and explanation of types used in a collection data.

  2. Guides for creating collections for static and custom applications.


Below is an interface that contains all the data structures necessary for your collection:

export interface NetworkSettings {
 protocol: string;
 containerPort: number;
 accessPort: number;
 addHostUrl: boolean;
 hostUrl: string;

The interface NetworkSettings is designed to configure your network settings, which you will call later within the interface collectionData. The properties within NetworkSettings are:

  • protocol: It holds the value of your network protocol and can be HTTPS, TCP, etc.

  • containerPort: This represents your network port number.

  • accessPort: The value representing your port number through which external clients can access your services if hosted inside a container.

  • addHostUrl: Indicates if the host URL should be added to the network configuration.

  • hostURL: The base URL hosting your service.

export interface AttribVariableParam {
   name: string;
   condition: string;
   conditionDescription?: string;
   defaultValue?: string;

This interface handles the creation of the attribute variable parameter within the collection you create. AttribVariableParam gets called with collectionData interface.

collectionData Interface
export interface collectionData { 
id: string; 
address: string, 
collectionName: string; 
collectionDescription: string; 
collectionSize: number; 
encrypt: boolean; 
license: boolean; 
licenseFee: string; 
royalty: string; 
category: string; 
percentageMonth: string; 
storageType: string; 
applicationType: null | string; 
tags: string; 
imageName: string; 
imageTag: string; 
privateImageRegistry: string; 
privateImageUsername: string; 
privateImagePassword: string; 
softwareLock: boolean; 
noDeployment: boolean; 
privateImage: boolean; 
status: boolean; 
mintStatus: string; 
mintCost: string; 
collectionCost: string; 
netWorkSetting?: NetworkSettings[]; 
environmentVariables?: string; 
stateFullSets?: boolean; 
args?: string; 
attributeVariableParam: AttribVariableParam; 
cpuRange: string; 
bandwidthRange: string; 
storageRange: string; 
nftMintedList?: number[]; 
commands?: string; 
instanceType: 'cpuStandard' | 'cpuIntensive' | 'gpuStandard'; dataPersistence?: boolean;
mountVolume?: string; 
subnetType?: number; 
subnetCount?: number; 
customAppStorageType?: string; 
collectionImage: null | File; 
nftImage: null | File; 
nftId: null | string; 
limitedEdition: boolean; 
staticFile: File[]; 
bundle: any; 
marketplaceList: boolean; 
publicMint: boolean; 
verified: boolean; 
paymentMade: boolean; 

The collectionData interface defines the structure of a collection within the package. Below is an explanation of all the parameters on the interface:

  • id: It is an auto-generated ID for your collection and can be left blank.

  • address: is the collection creator’s wallet address.

  • collectionName: The name you give your collection, which will be used as a metadata name for your NFT.

  • collectionDescription: Description of the collection you are creating which will be used for collection description in the marketplace.

  • collectionSize: The maximum number of NFTs that can be minted in the collection.

  • encrypt: This is used for static files.

  • license: This is the wallet address you use to receive fees whenever your NFT gets resold in the marketplace.

  • licenseFee: Fees for the license.

  • royalty: Royalty can be referred from any NFT collection.

  • category: Category of your collection, used in the marketplace to sort collections based on filters.

  • percentageMonth: Monthly percentage rate.

  • storageType: This could be files, videos, or folders, each with having its own encryption and launcher.

  • applicationType: Custom or static application.

  • tags: Used for search in the marketplace.

  • imageName: Name of the docker image.

  • imageTag: Tag for the docker image.

  • privateImageRegistry: Used for custom applications if your docker image is private.

  • privateImageUsername: Username for your private image registry.

  • privateImagePassword: Password for your private image registry.

  • softwareLock: Indicates if the software’s version or name cannot be updated.

  • noDeployment: Indicates if deployment is disabled.

  • privateImage: Indicates if the image is private.

  • status: This is updated by workers and shows static application creation status.

  • mintStatus: Minting status of your collection.

  • mintCost: This can be updated based on the price the collection owners want to collect per mint. However, mint costs $1 by default.

  • collectionCost: The cost it takes to create a static and custom application; for a static application, this is based on the static file size, and $1 for a custom application.

  • netWorkSetting: Used for custom applications.

  • environmentVariables: This is used for custom applications.

  • stateFullSets: Indicates if the collection has stateful sets; this is optional.

  • args: Additional arguments; this is optional.

  • attributeVariableParam: Attribute variable parameters.

  • cpuRange: CPU range required.

  • bandwidthRange: Bandwidth range needed for your collection.

  • storageRange: Storage range required for your application.

  • nftMintedList: List of minted NFTs; this is optional.

  • commands: Commands associated with the collection; this is optional.

  • instanceType: Type of instance (cpuStandard, cpuIntensive, gpuStandard).

  • dataPersistence: Indicates if data persistence is enabled; this is optional.

  • mountVolume: Volume mount; this is optional.

  • subnetType: Type of subnet; this is optional.

  • subnetCount: Number of subnets; this is optional.

  • customAppStorageType: Custom application storage type; this is optional.

  • collectionImage: Image file for the collection or null.

  • nftImage: Image file for the NFT or null.

  • nftId: ID of the NFT or null.

  • limitedEdition: Indicates if your collection is a limited edition.

  • staticFile: Static files associated with your collection.

  • bundle: Bundle data.

  • marketplaceList: Indicates if your collection is listed on the marketplace.

  • publicMint: Indicates if your collection is publicly mintable.

  • verified: Indicates if your collection is verified.

  • paymentMade: Indicates if payment has been made.

Use Cases

How to Create a Collection for a Custom Application

Creating a collection for a custom application is one of the use cases for which you can use the package; this guide outlines the API calls to create a collection for a custom application.

The following code shows how to use the StackOS application software development (SDK) to get a signature and send a POST request to create a collection:

const signature = await appManager!.getUrsulaAuth(formData.address); 
const response = await fetch(
    method: "POST", 
    headers: { 
      "Content-Type": "application/json", 
    body: JSON.stringify({ 
      collectionImage: collectionBannerUpload ? : null, 
      nftImage: nftImageUpload ? : null, 

In the above code:

  • The first line runs an authentication using the appManager object, and the function getUrsulaAuth validates the address stored in formData.

  • The second line sends a POST request to the link specified by process.env.NEXT_PUBLIC_STUDIO_SERVICE_URL, for example,, is concatenated by /createCollection and sends it to a specified endpoint for creating a collection.

  • The request body, a JSON string, contains several properties from the collectionData interface explained earlier that contain the data of the collection you are creating.

Implementing this API call will create a collection for a custom application.

You must pay a fixed cost of $1 to create a collection for a custom application.

How to Create a Collection for a Static Application

You can also create a collection for a static application by calling the package API. Follow these steps to create a collection for your static application.

Step 1: Upload your static file to AWS S3

To upload your file to AWS S3, you need to get an access key and a session key by calling this API:

const getCredentials = async (appManager: UIAppManager, address: string) => {
  const signature = await appManager!.getUrsulaAuth(address);

  if (signature.success) {
    try {
      const response = await fetch(
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          body: JSON.stringify({

      if (response.ok) {
        const responseData = await response.json();
        return {
          success: true,
          data: responseData,
      } else {
        return {
          success: false,
          data: Error("Unexpected error occurred"),
    } catch (error) {
      return {
        success: false,
        data: Error("Unexpected error occurred"),
  } else {
    return {
      success: false,
      data: Error("Failed to get signature"),

Here is what the code does:

  • It authenticates you and receives a signature, and if it succeeds, it sends a POST request to the specified endpoint, /getAwsCredentials.

  • After the request succeeds or passes, you get a temporary credential.

With this, you can upload the files using the credentials you get in return; every time you upload, you need to call this API to get the keys, as the keys have an expiration period. So keep in mind you have to call this API anytime you want to upload a file to refresh the credentials.

You need to save the file key in staticFile in collectionData, which will be processed. After you upload your file and have made the payment to create a custom application, the file gets downloaded and encrypted. After it is encrypted, it gets uploaded to IPFS and pinned to IPNS; this IPNS link will be stored in the contract when a new NFT is minted from your collection.

You can upload any file to AWS S3. For example, if it is a video you wish to upload, indicate so as the key of storageType, else it should be files.

Step 2: Update the staticFile Key

After updating the staticFile key, you should upload the collection to the API call made in the previous section.

Unlike custom applications, the cost of creating a collection for the static application is based on file size and not fixed.

To calculate what it will cost you, use:

const totalCost = 1 + (value[0].size * 
parseFloat(process.env.NEXT_PUBLIC_STORAGE_COST || "0.0000000037"));

Where the cost per byte of file size is 0.0000000037 and where value[0].size refers to the size of the file getting stored.

After making the payment, the collection will become active, and then you can mint the NFTs from the collection created.

Last updated