Skip to main content

useAirdropNFT() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to transfer tokens on your

Example 1

const Component = () => {
const editionDrop = useEditionDrop(<ContractAddress>);
const {
mutate: airdropNFT,
isLoading,
error,
} = useAirdropNFT(editionDrop);

if (error) {
console.error("failed to transfer batch NFTs", error);
}

return (
<button
disabled={isLoading}
onClick={() => airdropNFT({
tokenId: 2,
addresses: [{ address: "0x...", quantity: 2 }, { address: "0x...", quantity: 4 } }]
)}
>
Airdrop NFT
</button>
};

Example 2

const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: airdropNFT,
isLoading,
error,
} = useAirdropNFT(contract);

if (error) {
console.error("failed to transfer batch NFTs", error);
}

return (
<button
disabled={isLoading}
onClick={() => airdropNFT({
tokenId: 2,
addresses: [{ address: "0x...", quantity: 2 }, { address: "0x...", quantity: 4 } }]
)}
>
Airdrop NFT
</button>
);
};

Signature:

export declare function useAirdropNFT(
contract: Erc1155,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
AirdropNFTParams,
unknown
>;

Parameters

ParameterTypeDescription
contractErc1155an instance of a

Returns:

import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data">, unknown, AirdropNFTParams, unknown>

a mutation object that can be used to transfer batch NFTs