Typescript application that shows how to interact with the myria-core-sdk
library. The code samples provided in this project will help create new Myria projects, launch collections, and mint assets on the Myria Chain.
git clone https://gitlab.com/myriaworld/myrianet/blockchain/myria-ts-samples.git
cd myria-ts-samples
yarn
Rename the.env.example
file into .env
and provide the required configuration values:
# common
PUBLIC_KEY= <public key of the owner's Ethereum wallet>
PRIVATE_KEY= <private key of the owner's Ethereum wallet>
STARK_KEY= <stark key derived from the owner's Ethereum wallet>
# collection
CONTRACT_ADDRESS= <contract address deployed on Ethereum for a given collection>
METADATA_API_URL= <metadata API URL that returns JSON metadata schema for a given collection>
PROJECT_ID= <id of the project to which the collection will be added>
# mint
TOKEN_URI= <URL path to the mintable asset metadata>
TOKEN_ID= <unique identifier of a given asset, should be an incremental numeric value starting from 1>
Generates a Stark Key derived from a given Web3 private key.
Requirements:
- Provide
PRIVATE_KEY
environment variable
npm run generate-stark-key
Creates a project on Myria.
Requirements:
- Provide the
CONTRACT_ADDRESS
environment variable - Replace params values with your project details:
name
- the project namecompanyName
- the company name that will be working on the projectcontactEmail
- the contact email
npm run create-project
Returns a list of projects created on Myria.
npm run get-project-list
Returns details of a given Myria project by its id.
Requirements:
- Replace projectId value with your project id
npm run get-project-details
Update the project by its id.
Requirements:
- Provide the
PROJECT_ID
environment variable - Replace params values with new project details:
name
- new project namecompanyName
- new company name that will be working on the projectcontactEmail
- new contact email
npm run update-project
Creates a collection on Myria.
Requirements:
- Provide
CONTRACT_ADDRESS
,METADATA_API_URL
,PUBLIC_KEY
,PROJECT_ID
,STARK_KEY
environment variables - Replace params values with your collection details:
name
- collection namedescription
- collection description
npm run create-collection
Creates a metadata schema for existing collections on Myria.
Requirements:
- Provide
CONTRACT_ADDRESS
andSTARK_KEY
environment variables - Replace metadataSchema values with your metadata schema details. Each object of the array contains the following properties:
name
- the name of the metadata schema attribute. Should matchtrait_type
in the Opensea metadata schematype
- the type of the metadata schema attribute. Acceptsenum
,string
, andnumber
. In most cases, you should useenum
filterable
- the flag that defines if the attribute should be filterable on the Myria marketplace. Acceptstrue
orfalse
npm run create-metadata-schema
Returns a list of collections created on Myria.
Requirements:
- Replace params values with your request parameters:
limit
- the max number of items per requestpage
- the page number. Each page will contain the number of items based on thelimit
isHot
- the flag that defines if the returned items are listed as hot on the Myria marketplace
npm run get-collection-list
Returns details of a given Myria collection by its id.
Requirements:
- Replace collectionId value with your collection id
npm run get-collection-by-id
Returns details of a given Myria collection by its public id.
Requirements:
- Replace publicId value with your collection public id
npm run get-collection-by-public-id
Create an ERC721 mint transaction of a given asset on Myria.
Requirements:
- Provide
STARK_KEY
,CONTRACT_ADDRESS
,TOKEN_URI
,TOKEN_ID
environment variables - Replace feePercentage value with a royalty fee percentage for secondary sales
- Replace description value with a description for your asset
npm run create-erc721-mint-transaction
Mint multiple ERC721 assets on Myria. There are two options you can use to achieve the same result.
The first option represents multiple createMintTransactionERC721
calls. The number of calls equals the number of assets you need to mint.
Requirements:
- Provide
STARK_KEY
,CONTRACT_ADDRESS
,METADATA_API_URL
,PUBLIC_KEY
environment variables - Replace feePercentage value with a royalty fee percentage for secondary sales
- Replace startTokenId value with a starting token id
- Replace endTokenId value with an ending token id
npm run create-bulk-erc721-mint-transaction
The second option represents a single bulkMintableNftERC721
call that mints an array of assets passes as the assets
parameter. It's recommended to use less than 100 items at a time with this option.
Requirements:
- Provide
STARK_KEY
,CONTRACT_ADDRESS
,METADATA_API_URL
,PUBLIC_KEY
environment variables - Replace feePercentage value with a royalty fee percentage for secondary sales
- Replace startTokenId value with a starting token id
- Replace endTokenId value with an ending token id
npm run create-bulk-erc721-mint-transaction-v2
Returns details of a given mint transaction by its id.
Requirements:
- Provide
STARK_KEY
,CONTRACT_ADDRESS
,TOKEN_URI
,TOKEN_ID
environment variables - Replace transactionId value with desired mint transaction id
npm run get-mint-transaction-details
Returns a list of mint transactions by a given Stark Key.
Requirements:
- Provide
STARK_KEY
environment variable
npm run get-mint-transactions-by-stark-key
Returns details of a given Myria asset by its id.
Requirements:
- Replace assetId value with your asset id
npm run get-asset-by-id
Returns assets by its Stark Key.
Requirements:
- Provide
STARK_KEY
environment variable
npm run get-assets-by-stark-key
Returns all assets minted by a given public key.
Requirements:
- Provide
PUBLIC_KEY
environment variable
npm run get-assets-by-public-key
Returns details of a given asset vault by its asset id.
Requirements:
- Provide
STARK_KEY
environment variable - Replace assetId value with your asset id
npm run get-asset-vault-details