Skip to main content
Version: 0.4

The End to End Guide For Minting a Single NFT on the AVN

This guide will walk you through successfully submitting a transaction on the AVN to mint an NFT and verify the state of the transaction.

The first thing we need to do is ensure that you have npm installed. You'll find instructions on how to do this here. You'll also find instructions on how to install the avn-api library. Once that'S done, the next step is to set up your Substrate uri (SURI) as an environmental variable here. Setting your environmental variable makes things easier going forward.

Note, all transactions on the AVN must be paid for using AVT, so going forward it's important for you to have some AVT in your account. Uniswap is currently the best way to purchase AVT and this page provides instructions on how to get some. Note, you'll need 100 AVT in your SURI account to use the API. The tokens need to be lifted (moved) to the Aventus Network, and there are also instructions for that too here.

Once you have some AVT in your account, of which you can check your account balance here, let's get to the exciting bit, submitting a transaction to the AVN. For this guide, we'll show a simple transaction submitting 10 X tokens from one account to another.

const AvnApi = require("avn-api");
const GATEWAY = "<node_url>"; //Replace the node_url with the url received from Aventus.
const api = new AvnApi(GATEWAY);

const avnRelayerAddress = "5Fb...yTh"; //Please, request from Aventus.
const nftOwnerAddress = "bDB...9MH"; //Your address on the Aventus network
const externalRef = "https://5DA/gxV";
const t1AdminName = "0x1a2...b3c";
const royalties = [];

async function main() {
await api.init();

const result = await api.send.mintSingleNft(
avnRelayerAddress,
nftOwnerAddress,
externalRef,
royalties,
t1AdminName
);
// Returns a request id
console.log(result);
}

(async () => {
await main();
})();

Expected Transaction Submission Output

f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a
Congratulations! You've now successfully minted an NFT on the AVN.

State of the Transaction

To query the AVN on the state of the transaction:

let status = await api.poll.requestState(requestId);
console.log(`Current status: ${status}`);

Expected State Output

Current status: Processed