How to Deploy an ERC-721 Smart Contract to Avalanche and Mint an NFT with Ankr, Hardhat, and Ethers.js 🔺

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • dotenv

    Loads environment variables from .env for nodejs projects.

    Set and keep our environment variables hidden by using [dotenv](https://www.npmjs.com/package/dotenv)↗️

  • ipfs

    Peer-to-peer hypermedia protocol

    // require the correct libraries require("dotenv").config(); require("@nomiclabs/hardhat-ethers"); // Our contract’s ABI (Application Binary Interface) is the interface enabling our js script to interact with our smart contract. Hardhat generates and stores the ABI version of our contract in the artifacts folder as a JSON file. const contract = require("../artifacts/contracts/AnkrAvalancheNFT.sol/AnkrAvalancheNFT.json"); const contractInterface = contract.abi; let provider = ethers.provider; const tokenURI = "https://ipfs.io/ipfs/bafybeib3skazl2dhjctsmiroc6ug5zketfooovt53ast5pxytcan2n3zba/avaxankr.json"; const privateKey = `0x${process.env.PRIVATE_KEY}`; const wallet = new ethers.Wallet(privateKey); wallet.provider = provider; const signer = wallet.connect(provider); // https://docs.ethers.io/v5/api/contract/contract const nft = new ethers.Contract( process.env.CONTRACT_ADDRESS, contractInterface, signer ); const main = () => { console.log("Waiting 5 blocks for confirmation..."); nft .mint(process.env.PUBLIC_KEY, tokenURI) .then((tx) => tx.wait(5)) .then((receipt) => console.log( `Your transaction is confirmed, its receipt is: ${receipt.transactionHash}` ) ) .catch((e) => console.log("something went wrong", e)); }; main();

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts