To begin, clone this repository:
git clone https://github.com/immutable/imx-examples.git
cd imx-examplesCopy environment file
cp .env.example .envSet the onboarding private key in .env. Your private key will be used to create a signed payload only and will not be sent to our backend services.
OWNER_ACCOUNT_PRIVATE_KEY=YOUR_PRIVATE_KEYInstall dependencies
npm installWe provide an authentication service to protect your administrative level assets from being accessed or updated by someone else. This is done using a simliar technique as described here.
In order to use services like creating a project or collection, you will first need to register as an Immutable X user. This is done by setting up an account using the private key from the wallet account you would like to specify as the owner of the project.
Run the following script:
Requires environment variables OWNER_ACCOUNT_PRIVATE_KEY to be set.
npm run onboarding:user-registrationUpdate the values in file 2-create-project.ts with the values of the project you want to create.
name- The name of the projectcompany_name- The name of the companycontact_email- Your associated company email
Once updated, run the following script to create your project:
Requires environment variables OWNER_ACCOUNT_PRIVATE_KEY to be set.
npm run onboarding:create-projectOn completion, the script will log the ID of the created project. Save this ID for use in the next step.
A collection refers to a smart contract you have deployed. Minted assets belong to a collection. In order to mint assets on L2 you must first register your collection (smart contract) with Immutable X.
Add the collection contract address to the environment variable COLLECTION_CONTRACT_ADDRESS.
Set COLLECTION_PROJECT_ID to the project ID you created with create-project step
Once updated, run the following script to create your collection:
Requires environment variables OWNER_ACCOUNT_PRIVATE_KEY, COLLECTION_PROJECT_ID and COLLECTION_CONTRACT_ADDRESS to be set.
npm run onboarding:create-collectionIf you see a replacement transaction underpriced error message when trying to run create-collection please try again in 5 minutes.
Update the values in file 4-add-metadata-schema.ts with the values of the metadata you want to define.
Once updated, run the following script to create your collection:
Requires environment variables OWNER_ACCOUNT_PRIVATE_KEY and COLLECTION_CONTRACT_ADDRESS to be set.
npm run onboarding:add-metadata-schema