ERC721Airdrop
Functionality available for contracts that implement the
ERC721Airdrop
extension.
Deploy an ERC721Airdrop
contract from the Explore page:
drop
Airdrop ERC721 tokens to multiple recipients.
// Airdrop content array, with recipients and tokenIds
const contents = [
{
recipient: "0xabc...", // first recipient address
tokenId: 0,
},
{
recipient: "0x123...", // second recipient address
tokenId: 2,
},
];
const tokenAddress = "0x..."; // Address of the ERC721 token being airdropped
const tokenOwner = "0x..."; // Address of the owner of the tokens being airdropped
const output = await contract.airdrop721.drop(
tokenAddress,
tokenOwner,
contents,
);
// the `output` return value above contains:
// - count of successful and failed drops
// - array containing failed drops, if any
Return Value
The drop
function returns an array of recipients for who the airdrop failed (empty means all transfers were successful).
Parameters
Configuration
tokenAddress
A string
representing the address of the ERC721 token being airdropped:
const tokenAddress = "0x..."; // Address of the ERC721 token being airdropped
const contents = [
{
recipient: "0xabc...", // first recipient address
tokenId: 0,
},
{
recipient: "0x123...", // second recipient address
tokenId: 2,
},
];
const tokenOwner = "0x...";
const output = await contract.airdrop721.drop(
tokenAddress,
tokenOwner,
contents,
);
tokenOwner
A string
representing the address of the owner of the tokens being airdropped:
const contents = [
{
recipient: "0xabc...", // first recipient address
tokenId: 0,
},
{
recipient: "0x123...", // second recipient address
tokenId: 2,
},
];
const tokenAddress = "0x...";
const tokenOwner = "0x..."; // Address of the owner of the tokens being airdropped
const output = await contract.airdrop721.drop(
tokenAddress,
tokenOwner,
contents,
);
contents
An array
of the contents of the airdrop, containing the recipients addresses and tokenId to airdrop.
const contents = [
{
recipient: "0xabc...", // first recipient address
tokenId: 0,
},
{
recipient: "0x123...", // second recipient address
tokenId: 2,
},
];
const tokenAddress = "0x...";
const tokenOwner = "0x...";
const output = await contract.airdrop721.drop(
tokenAddress,
tokenOwner,
contents,
);