Create a Project
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:
- Run a script to create a project
- Myria will attempt to create a project based on the data provided:
- If the Stark Key is registered on Myria and project details are valid, a project is created
- If the Stark Key isn't registered on Myria or project details are invalid, the request fails
Limitations
The following are known limitations for all projects:
- To create a project, you need to register a Myria developer account with your Stark Key. Otherwise, Myria won't be able to identify you in its system.
- You can add a limited number of collections to your project each month. For more details, check collection limitations.
Implementation
Prerequisites
Example
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:
- Create an empty directory on your local machine. Then, open it in VS Code or your favorite Web IDE:
mkdir myria-samples
- Set up
package.json
:
- yarn
- npm
yarn init
npm init
- Install dependencies:
- yarn
- npm
yarn add -D typescript @types/node ts-node myria-core-sdk @starkware-industries/starkware-crypto-utils
npm i --save-dev typescript @types/node ts-node myria-core-sdk @starkware-industries/starkware-crypto-utils
- Generate
tsconfig.json
:
- yarn
- npm
tsc --init
tsc --init
- Create the
create-project.ts
file in the above project and paste this code:
- Typescript
import { ProjectManager, CreateProjectParams, 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);
// define params
const params: CreateProjectParams = {
name: "PROJECT_NAME",
companyName: "COMPANY_NAME",
contactEmail: "COMPANY_EMAIL",
starkKey: "STARK_KEY",
};
// create a project
const newProjectResponse: ProjectResponse | undefined =
await projectManager.createProject(params);
// log the result
console.log(JSON.stringify(newProjectResponse, null, 2));
})();
Replace the createProject
arguments as follows:
PROJECT_NAME
- the project nameCOMPANY_NAME
- the company name of the projectCONTACT_EMAIL
- the contact email of the projectSTARK_KEY
- Stark Key, has to start with0x
- Add a script to load the
create-project.ts
file inpackage.json
:
{
"scripts": {
"create-project": "ts-node create-project.ts"
},
}
- 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.
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.