Skip to main content

useMintNFT

Description

Hook for minting a new NFT for a specific NFT contract.

Parameters

NameTypeDescription
tostringthe wallet address that receives the NFT after mint
tokenURIstringthe URL of the metadata. We recommend using IPFS.
[overrides]OverridesOptional 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://" });
}