☁️Upload Reference Material To Arweave and Mint
Uploading reference material to permanent storage through the Mintbase JS Storage module is easy. This makes including minting functionality on your app a breeze by abstracting away the permanent metadata storage! This guide will walk you through it.
Step 1: Get your API key
...To be added For now, this functionality is temporarily not restricted by an API key
Step 2: Install the Storage Module
or
Step 3: Make a component that uploads a file
This example accepts a file via input and then creates a metadata object in which it is contained. It then calls the storage method uploadReference,
receiving a JSON argument resulting in an upload of the reference to arweave.
The neat trick here is that within this JSON object, you can have certain fields containing files (media, document, animation_url) and these will also get permanently uploaded! If you want to learn more about how permanent storage and metadata work check out the Anatomy of a Non-Fungible Token Guide
When a result is returned the payload will contain an id field. When this is appended to the https://arweave.net/ base URI we will have a link to a permanently stored JSON containing our also permanently stored media!
Step 4: Use the Arweave Link to Mint a Token!
Now that we have a link to the permanently stored file we can proceed to make the contract call. If you haven't deployed a contract yet check out our guide on or reference the documentation.
For more information on how to mint through a call to your very own token contract check out Make Your First Contract Call and the Mint method documentation.
In this snippet, we are getting an instance of the connected wallet and constructing a Mint method call object, and supplying them both to the execute command.
The Arweave URL that we previously generated should be passed into the reference field. More in-depth information relating to the fields can be found in the documentation.
With all this done you should now be able to mint tokens from the uploaded reference material!
Last updated