useMintNFT
Description
Hook for minting a new NFT for a specific NFT contract.
Parameters
| Name | Type | Description |
|---|---|---|
| to | string | the wallet address that receives the NFT after mint |
| tokenURI | string | the URL of the metadata. We recommend using IPFS. |
| [overrides] | Overrides | Optional overrides for the contract call. |
Example
import { useContract, useMintNFT } from "@openformat/react";
// address of a created NFT (ERC721) contract. You can get this from the subgraph.
const address = "0x123...";
// returns an instance of the NFT.
const { data: nft } = useContract(address);
const { data, mint, isLoading, error } = useMintNFT(nft);
async function handleMint() {
await mint({ to: "0x123...", tokenURI: "ipfs://" });
}