DApp states go through context level to mini React components.
Starting from dapp root → src→ views → home → index
const mintKeypair = anchor.web3.Keypair.generate();
Generate a mint account for the NFT token and pass it to a lower-level component named MintNFTButton
. In this component, we receive the mintAccount as a prop and we use it to set up the mint NFT account and metadata account for NFT.
Then, mint the NFT to the minter's wallet by creating two consecutive transactions: createTokenMint
and mintTo
. After these transactions, the minter will have the NFT in their desired wallet or account.
The second functionality of the DApp is transferring the minted NFT to another user. To do this:
root → src → component → nft → NftCard
.This will successfully transfer the NFT to the other user.
This is just an overview of dapp’s mint state and flow for transactions.