Docs

useAirdropNFT

Hook for airdropping ERC1155 NFT tokens to multiple wallet addresses at once.

Available to use on smart contracts that implement the ERC1155 standard.

Performs a batch transfer from the connected wallet to the specified addresses. This means you need to have the total number of tokens you wish to airdrop available in the wallet that performs this transaction.

Example

import { useAirdropNFT, useContract, Web3Button } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: airdropNft, isLoading, error } = useAirdropNFT(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
airdropNft({
addresses: [
{
address: "0x123",
quantity: 1,
},
],
tokenId: tokenId,
})
}
>
Airdrop NFT
</Web3Button>
);
}

Parameters

Returns

Mutation object that to transfer batch NFTs

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

options

The mutation function takes an object with the following properties:

tokenId

The token ID of the NFT to airdrop.

addresses

An array of objects containing an address and quantity of NFTs to airdrop to each address.