Frontend Minting and Integration Flashcards
7 cards from real NFT practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Frontend Minting and Integration flashcards as text
In a React dApp, which library function is most commonly used to connect a browser wallet via injected providers like MetaMask?
Answer: window.ethereum.request({ method: 'eth_requestAccounts' })
EIP-1193 providers expose window.ethereum, and eth_requestAccounts prompts the user to connect their accounts.
When minting an NFT from the frontend, why should the total mint cost (price × quantity) be sent in the transaction's 'value' field?
Answer: The contract's payable mint function requires ETH to cover the price
A payable mint function expects msg.value to equal the required payment, so the value field must carry the ETH.
What is the purpose of listening to a contract's 'Transfer' event after a mint transaction confirms on the frontend?
Answer: To detect the newly minted tokenId and update the UI
The Transfer event from the zero address signals a mint and exposes the new tokenId for UI updates.
Which approach prevents a user from being charged for a failed mint when the sale is paused on-chain?
Answer: Call a read-only view (e.g., saleActive) before sending the transaction
Reading the sale state first lets the UI block transactions that would revert, saving the user gas.
In ethers.js v6, what does a 'Contract' instance need to send a state-changing mint transaction rather than just read data?
Answer: A signer connected to the contract
Read calls work with a provider, but write transactions require a signer that can authorize and submit them.
Why is it risky to display 'mint successful' immediately after calling the contract method without awaiting the receipt?
Answer: The transaction may still revert or be dropped before confirmation
A submitted transaction can still fail or be dropped, so success should only show after the receipt confirms.
What does the EIP-1193 'chainChanged' event allow a dApp frontend to do?
Answer: Detect when the user switches networks and refresh or reload state
Listening for chainChanged lets the dApp react to network switches, often by reloading to avoid stale state.