Skip to main content

Projects Reference

This document is a reference to the Projects module of the Myria Core SDK. The module contains information about Myria projects.

Interfaces

CreateProjectParams

Data structure passed to createProject() method, which contains required data to create a new project.

interface CreateProjectParams {
name: string;
companyName: string;
contactEmail: string;
starkKey: string;
}

Attributes

  • name- project name
  • companyName - company name that will be working on the project
  • contactEmail - contact email
  • starkKey - Stark Key, has to start with 0x

ProjectResponse

Data structure returned by the createProject() method.

interface ProjectResponse {
status: string;
data: ProjectResponseData[] | ProjectResponseData | undefined;
}

Attributes

ProjectResponseData

Data structure that contains data value of ProjectResponse.

interface ProjectResponseData {
id: number;
createdAt: string;
updatedAt: string;
name: string;
companyName: string;
contactEmail: string;
collectionLimitExpiresAt?: string | null;
collectionMonthlyLimit?: number;
collectionRemaining?: number;
publicId?: string;
starkKey: string;
}

Attributes

  • id - project id on the Myria network
  • createdAt - when the project was created
  • updatedAt - when the project was updated last time
  • name- project name
  • companyName - company name that will be working on the project
  • contactEmail - contact email
  • collectionLimitExpiresAt - expiration date of your current limit to create collections
  • collectionMonthlyLimit - the max number of collections to create each month for a given project
  • collectionRemaining - the number of collections remained to create this month
  • publicId - public id of your project within the Myria network
  • starkKey - Stark Key, has to start with 0x

UpdateProjectParams

Data structure passed to updateProject() method, which contains required data to update a project.

interface UpdateProjectParams {
id: number;
name: string;
companyName: string;
contactEmail: string;
starkKey: string
}

Attributes

  • id - project id on the Myria network
  • name- project name
  • companyName - company name that will be working on the project
  • contactEmail - contact email
  • starkKey - Stark Key, has to start with 0x

Methods

createProject()

Creates a new Myria project.

createProject(payload: CreateProjectParams): Promise<ProjectResponse | undefined>;

Parameters

Returns

Returns a project object.

Example

import { ProjectManager, CreateProjectParams, ProjectResponse, EnvTypes } from "myria-core-sdk";

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

const projectManager: ProjectManager = new ProjectManager(env);

const params: CreateProjectParams = {
name: "PROJECT_NAME",
companyName: "COMPANY_NAME",
contactEmail: "COMPANY_EMAIL",
starkKey: "STARK_KEY",
};

const newProjectResult: ProjectResponse | undefined =
await projectManager.createProject(params);
})();

Response

ProjectResponse
{
"id": 42,
"createdAt": "2022-07-08T09:51:23.742Z",
"updatedAt": "2022-07-08T09:51:23.742Z",
"name": "Test Game",
"companyName": "Gaming Studio X",
"contactEmail": "test@google.com",
"collectionLimitExpiresAt": null,
"collectionMonthlyLimit": 5,
"collectionRemaining": 5,
"mintLimitExpiresAt": null,
"mintMonthlyLimit": 50000,
"mintRemaining": 50000,
"publicId": "9c217811-74a9-4e5f-9999-4e36968c71c5",
"__entity": "ProjectEntity"
}

getProjectDetail()

Returns details of the Myria project.

getProjectDetail(id: string): Promise<ProjectResponse | undefined>;

Parameters

  • id - project id

Returns

Returns an object with response call status and the data object that contains information about the project.

Example

import { ProjectManager, ProjectResponse, EnvTypes } from "myria-core-sdk";

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

const projectManager: ProjectManager = new ProjectManager(env);

const projectDetailResponse: ProjectResponse | undefined =
await projectManager.getProjectDetail("PROJECT_ID");
})();

Response

ProjectResponse
{
"status": "success",
"data": {
"id": 10,
"createdAt": "2022-07-05T09:41:43.380Z",
"updatedAt": "2022-07-05T09:41:43.380Z",
"name": "Auto_tester_root_1657014097318",
"companyName": "Myria",
"contactEmail": "test@myria.com",
"collectionLimitExpiresAt": null,
"collectionMonthlyLimit": 1,
"collectionRemaining": 1,
"mintLimitExpiresAt": null,
"mintMonthlyLimit": 1,
"mintRemaining": 1,
"publicId": "2681be5f-d373-4d77-a25f-b62ace05be3a",
"__entity": "ProjectEntity"
}
}

getProjectList()

Returns a list of available Myria projects.

getProjectList(): Promise<ProjectResponse | undefined>;

Parameters

No parameters.

Returns

Returns an object with response call status and the data object that contains the list of projects.

Example

import { ProjectManager, ProjectResponse, EnvTypes } from "myria-core-sdk";

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

const projectManager: ProjectManager = new ProjectManager(env);

const projectListResponse: ProjectResponse | undefined =
await projectManager.getProjectList();
})();

Response

ProjectResponse
{
"status": "success",
"data": {
"items": [
{
"id": 3,
"createdAt": "2022-07-05T03:39:54.306Z",
"updatedAt": "2022-07-05T03:39:54.306Z",
"name": "Auto_tester_root_1656992388716",
"companyName": "Myria",
"contactEmail": "test@myria.com",
"collectionLimitExpiresAt": null,
"collectionMonthlyLimit": 1,
"collectionRemaining": 1,
"mintLimitExpiresAt": null,
"mintMonthlyLimit": 1,
"mintRemaining": 1,
"publicId": "a25be464-39c1-4931-baef-43ac985128dc",
"__entity": "ProjectEntity"
},
...
],
"meta": {
"totalItems": 42,
"itemCount": 10,
"itemsPerPage": 10,
"totalPages": 5,
"currentPage": 1
},
"links": {
"first": "http://localhost:8081/v1/orders?limit=10",
"previous": "",
"next": "http://localhost:8081/v1/orders?page=2&limit=10",
"last": "http://localhost:8081/v1/orders?page=5&limit=10"
}
}
}

updateProject()

Updates a Myria project by a given id.

updateProject(payload: UpdateProjectParams): Promise<ProjectResponse | undefined>;

Parameters

Returns

Returns a project object.

Example

import { ProjectManager, UpdateProjectParams, ProjectResponse, EnvTypes } from "myria-core-sdk";

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

const projectManager: ProjectManager = new ProjectManager(env);

const params: UpdateProjectParams = {
id: PROJECT_ID
name: "PROJECT_NAME",
companyName: "COMPANY_NAME",
contactEmail: "COMPANY_EMAIL",
starkKey: "STARK_KEY"
};

const updatedProjectResult: ProjectResponse | undefined =
await projectManager.createProject(params);
})();

Response

ProjectResponse
{
"id": 42,
"createdAt": "2022-08-02T03:47:09.486Z",
"updatedAt": "2022-08-09T07:08:43.181Z",
"name": "New name",
"companyName": "New company name",
"contactEmail": "newemail@gmail.com",
"collectionLimitExpiresAt": null,
"collectionMonthlyLimit": 0,
"collectionRemaining": 0,
"mintLimitExpiresAt": null,
"mintMonthlyLimit": 0,
"mintRemaining": 0,
"publicId": "23024b5f-a491-447a-abd8-bd2897eef326",
"__entity": "ProjectEntity"
}