generateAirdropSignatureERC20

Generates the req and signature for sending ERC20 airdrop.

Example

import {
airdropERC20WithSignature,
generateAirdropSignatureERC20,
} from "thirdweb/extensions/airdrop";
// list of recipients and amounts to airdrop for each recipient
const contents = [
{ recipient: "0x...", amount: 10n }, // amount in wei
{ recipient: "0x...", amount: 15n }, // amount in wei
{ recipient: "0x...", amount: 20n }, // amount in wei
];
const { req, signature } = await generateAirdropSignatureERC20({
account,
contract,
airdropRequest: {
tokenAddress: "0x...", // address of the ERC20 token to airdrop
contents,
},
});
const transaction = airdropERC20WithSignature({
contract,
req,
signature,
});
await sendTransaction({ transaction, account });
function generateAirdropSignatureERC20(options: GenerateAirdropERC20SignatureOptions) : Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }>

Parameters

The options for the airdrop.

Type

let options: {
account: Account;
airdropRequest: GenerateReqInput;
contract: ThirdwebContract;
};

Returns

let returnType: Promise<{ req: { contents: readonly Array<{ amount: bigint; recipient: string }>; expirationTimestamp: bigint; tokenAddress: string; uid: `0x${string}` }; signature: `0x${string}` }>

A promise that resolves to the req and signature.