Examples quickstart: create a Living Asset
In this page we explain how to use a simple script from our examples repository.
To follow this example you will need to have installed on your development machine:
- NodeJS
- GraphQLPlayground or any similar GraphQL IDE
- The details for the Freeverse Universe already created for you by our onboarding team, along with the GraphQL endpoint URL - contact us if you do not yet have a universe.
Setup
As instructed in the Github Readme, after cloning into the project run
cd nodejs && npm ci
to setup the environment and install all relevant packages.
Creating an Asset
Navigate to the file nodejs/asset_create.js
; open it and edit the first three variables to the your universe owner credentials (private key, public address, universe id)
Feel free to modify the asset properties and metadata below, as you see fit, then save the file.
From a terminal, navigate to the nodejs
folder and run
node asset_create.js
The command will output a GraphQL mutation with the signed query, in the correct format, to the terminal.
Sending the mutation
You may use any method to send this mutation to our GraphQL endpoint; though in this example we are using GraphQL playground. Open the editor and point it to the url provided. Paste the mutation directly into the left-hand panel of the ID and press the middle play button to send it. In the right-hand panel, you will see the ID of the newly created asset.