useMintNFTSupply

Hook for minting additional supply to an existing ERC-1155 token.

Available to use on contracts that implement the ERC1155Mintable interface, such as the Edition or Edition Drop .

The wallet address that initiates this transaction must have minting permissions on the contract.

Example

import {
useContract,
useMintNFTSupply,
Web3Button,
} from "@thirdweb-dev/react";
const contractAddress = "{{contract_address}}";
const walletAddress = "{{wallet_address}}";
const tokenId = "{{token_id}}";
const additionalSupply = "{{additional_supply}}";
function App() {
// Contract must be an ERC-1155 contract that implements the ERC1155Mintable interface
const { contract } = useContract(contractAddress);
const {
mutateAsync: mintNftSupply,
isLoading,
error,
} = useMintNFTSupply(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
mintNftSupply({
additionalSupply: additionalSupply, // Quantity to mint
to: walletAddress, // Address to mint to
tokenId: tokenId, // Token ID to add supply to
})
}
>
Mint NFT Supply
</Web3Button>
);
}
function useMintNFTSupply(
contract: Erc1155<BaseERC1155 | BaseSignatureMintERC1155>,
): UseMutationResult<
unknown,
unknown
>;

Parameters

Instance of a Erc1155

Type

let contract: Erc1155<BaseERC1155 | BaseSignatureMintERC1155>;

Returns

let returnType: UseMutationResult<
unknown,
unknown
>;

Mutation object to mint a more supply of a token id to the provided wallet

const { mutateAsync, isLoading, error } = useMintNFTSupply(contract);

options

The mutation function takes an object with the following properties:

additionalSupply

The quantity of additional supply to mint.

For example, if you have 10 quantity so far, and you want to mint 5 more, set additionalSupply to 5 .

Can be a string or number .

to

The wallet address to mint the new supply to.

To use the connected wallet address, use the useAddress hook.

tokenId

The token ID of the NFT to mint additional supply to.

Can be a string or number .