wagmi for etheruem hooks to get read write functionality on Blockchain
npm i wagmiwallet connectivty requires connectKit which offer different Evm wallet connections
npm i connectkit viem Using axios for get request for fetching UI from the ipfs
npm i axiosUsing typechain for generating Types for Solidiity Smart contract
npm install --save-dev typechaintypechain requires ethers to use the static types so better install it as well its a web3 library for read and writing function call for blockchain
npm i ethersYou need to clone this repo using
git clone urlofthisrepothen install dependencies
npm ithen run the development server
npm startbut first need to configure the env file require to run this
-
Get Infure id from Infura get API key
-
Get Pinata Jwt from Pinata
-
Get wallet connect APi Key from walletConnect
after getting these keys create .env file and check variable name from .env.example and set it up
index.tsxsets upConnectKitand configuresWagmi. It also sets up React Router.App.tsxcontains all the routes and the navigation bar.- The navigation bar includes a
ConnectKit buttonfor connecting EVM wallets and a read on-chain function to check how many NFTs the owner has. - The
Contract-typesfolder containsstatic typings required for Solidity smart contractsusage.
- Pages for all the routes:
- The main page is a static page.
mintNFTpage allows users to select an image and display it in a container, along with input fields for the NFT's name and description.myNFTspage displays NFTs owned by the user using a read function. It fetches all token IDs that exist within the contract and generates a card for each owned NFT.NFTListingpage lists all NFTs without checkingownership, showing all available NFTs.- The
Ui foldercontains two modal components:mintModalforminting NFTsandmodal.tsxfortransferring minted NFTs.
-
utility functions, including a
debug console loggerthat can be toggled on or off. -
The hooks file contains functions for interacting with
Wagmi, reducing redundancy when defining multiple functions for different operations. -
ImageUploaderandMetaDataUploaderhandle thePOST APIfunctionality for uploading data toPinata IPFS.
-
TotalTokenIdreturns thetotal numberoftokens minted, which is used to determine the number of NFTs to display. -
OwnerOfdefines theOwnedListedNFTscomponent, which generates cards for owned NFTs. -
ListedNFTgenerates cards for listed NFTs. -
The
navbar.TSXHas onlynavbar elementandconnectkitbutton for evm wallet connection
- contract ABIs, which can be updated if you want to use your own ERC721 contracts.
- NFT contract is deployed on polygon with address
0x68377b4BDf3b1E4804D15E81774c5398A670E5eE. - It is also verified you can run function on polygon mumbai scan as well.
- Code and Abi can be seen there as well.
- This project doesnot contain any database to store users nft so while getting data from chain and ipfs it continously send get request and show it show the data is continously fetching from respective servers no local storage feature to store and fecth again plus no any kind of other session storage. So when you mint nft and go to my Nft it might show your data a little late due to network fetching it depends on internet speed and your browser.
- That's all.
- For Usage add all variables to env file and use the
git clone this repo
cd [folder]
npm i --legacy-peer-deps #to avoid any deps error on installation
npm start DOC: https://docs.google.com/document/d/1L5C7Ly7nvcoPwnWULtajUgpR1XLgRdGx4NAq2zKqqjw/edit?usp=sharing