Skip to main content

Create a Project with SDK

Learn how to create a Myria project.

Projects Overview

When building on Myria, projects are the highest component in the hierarchy. Assets belong to a collection, and collections belong to a project. One project can have multiple collections

Once you've registered a developer account, creating your project is the next step. After you've created a project, you can add collections to that project, and then assets to that collection.

Creating projects

Prerequisites

  • Generate a Web3 public key and Stark Key, and register your developer account entity as described in the quickstart

Project creation flow

The basic project creation flow is:

  1. Run a script to create a project
  2. Myria will attempt to create a project based on the data provided:
    • Developer's API Key - It can be generated at Main Developer Portal page
    • Myria User ID - The unique registered Myria User ID - once developer has onboarded and registered successfully in Myria.

Limitations

The following are known limitations for all projects:

Implementation

Prerequisites

  • Basic Javascript and Typescript knowledge
  • Web IDE such as VS Code
  • Latest NodeJs

Example

info

You can find the full implementation of this code sample in the myria-ts-samples repository.

You can create a new Myria project as follows:

  1. Create an empty directory on your local machine. Then, open it in VS Code or your favorite Web IDE:
mkdir myria-samples
  1. Set up package.json:
yarn init

vs-code-init

  1. Install dependencies:
yarn add -D typescript @types/node ts-node myria-core-sdk @starkware-industries/starkware-crypto-utils
  1. Generate tsconfig.json:
tsc --init
  1. Create the create-project.ts file in the above project and paste this code:
import { ProjectManager, CreateProjectParamsByAPIKey, ProjectResponse, EnvTypes } from "myria-core-sdk";

(async (): Promise<void> => {
// define the environment: STAGING or PRODUCTION
const env = EnvTypes.STAGING;

// get access to the `ProjectManager`
const projectManager: ProjectManager = new ProjectManager(env);

const params: CreateProjectParamsByAPIKey = {
name: "Game Project Test",
companyName: "GamePartnerWithMyria",
contactEmail: "world.game@myria.com",
apiKey: 'Your api key', // could generate on the myria portal for partner
myriaUserID: 'your unique user ID in myria system',
};

console.log("Created project details information...");
const data: ProjectResponse = await projectManager.createProjectByApiKey(params);

console.log("New project details response:");
console.log(JSON.stringify(data, null, 2));

})();

Replace the createProject arguments as follows:

  1. Add a script to load the create-project.ts file in package.json:
{
"scripts": {
"create-project": "ts-node create-project.ts"
},
}
  1. Run the create-project script:
npm run create-project

If you create a project successfully, you will see the response that looks as follows:

{
"id": 10,
"createdAt": "2022-07-06T06:05:09.697Z",
"updatedAt": "2022-07-06T06:05:09.697Z",
"name": "Test Game",
"companyName": "Gaming Studio X",
"contactEmail": "test@gamestudiox.com",
"collectionLimitExpiresAt": null,
"collectionMonthlyLimit": 5,
"collectionRemaining": 5,
"mintLimitExpiresAt": null,
"mintMonthlyLimit": 50000,
"mintRemaining": 50000,
"publicId": "29aefbd7-44fa-4e40-a4e0-8253ee21bfba",
"__entity": "ProjectEntity"
}

Make sure to write down your project id and publicId. You will need those values later.

Next steps

Now that you have a Myria project, you can create your first collection.

info

Please note, in the Staging environment you can create five collections and 50,000 mint transactions per collection per month. If you want to create collections for your project on the Production environment, or you need to increase those limits, please contact our team. Be sure to include your project id in the request message.