Skip to content

createAirdrop

Create an airdrop.

Usage

example.ts
import { mintclub } from 'mint.club-v2-sdk'
 
const wallets = [
	'0x...',
	'0x...',
	'0x...',
] as `0x${string}`[]
 
const json = JSON.stringify(wallets, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const ipfsCID = await mintclub.ipfs.add('YOUR API KEY', blob);
const merkleRoot = await mintclub.utils.generateMerkleRoot(wallets);
 
await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop',
	token: '0x...',
	isERC20: true,
	amountPerClaim: 1000000000000000n,
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

Return Value

Promise<TransactionReceipt>

Returns a promise that resolves to a TransactionReceipt object when the transaction is successful.

Parameters

title

  • Type: string

The title of the airdrop.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...',
	isERC20: true,
	amountPerClaim: 1000000000000000n,
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

token

  • Type: '0x${string}'

The address of the token to be airdropped.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n,
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

isERC20

  • Type: boolean

If the token is an ERC20 token.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true, 
	amountPerClaim: 1000000000000000n,
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

amountPerClaim

  • Type: bigint

The amount of tokens to be airdropped per claim.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n, 
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

walletCount

  • Type: number

The number of wallets to be airdropped to.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n, 
	walletCount: wallets.length, 
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

startTime

  • Type: number

The start time of the airdrop in seconds.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n, 
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000), 
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID
}) 

endTime

  • Type: number

The end time of the airdrop in seconds.

await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n, 
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000), 
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7), 
	merkleRoot,
	ipfsCID
}) 

merkleRoot

  • Type: '0x${string}'

The merkle root of the wallets to be airdropped to.

const merkleRoot = await mintclub.utils.generateMerkleRoot(wallets); 
 
await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop', 
	token: '0x...', 
	isERC20: true,
	amountPerClaim: 1000000000000000n, 
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000), 
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot, 
	ipfsCID
}) 

ipfsCID

  • Type: string

The IPFS CID of the wallets JSON.

import { mintclub } from 'mint.club-v2-sdk'
 
const wallets = [
	'0x...',
	'0x...',
	'0x...',
] as `0x${string}`[]
 
const json = JSON.stringify(wallets, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const ipfsCID = await mintclub.ipfs.add('YOUR API KEY', blob); 
 
await mintclub.network('base').airdrop.createAirdrop({
	title: 'Test Airdrop',
	token: '0x...',
	isERC20: true,
	amountPerClaim: 1000000000000000n,
	walletCount: wallets.length,
	startTime: Math.floor(Date.now() / 1000),
	endTime: Math.floor(Date.now() / 1000 + 60 * 60 * 24 * 7),
	merkleRoot,
	ipfsCID 
}) 

onAllowanceSignatureRequest (optional)

  • Type: onAllowanceSignatureRequest?: () => void;
  • Default: undefined

Callback function for when the user is requested to sign the approval transaction.

await mintclub.network('base').airdrop.createAirdrop({
	 onAllowanceSignatureRequest: () => {} 
})

onAllowanceSigned (optional)

  • Type: onAllowanceSigned?: (txHash: '0x${string}') => void;
  • Default: undefined

Callback function for when the user is signs the approval transaction.

await mintclub.network('base').airdrop.createAirdrop({
	 onAllowanceSigned: (txHash) => {} 
})

onAllowanceSuccess (optional)

  • Type: onAllowanceSuccess?: (receipt: TransactionReceipt) => void;
  • Default: undefined

Callback function for when the approval transaction is successful.

await mintclub.network('base').airdrop.createAirdrop({
     onAllowanceSuccess: (receipt) => {} 
})

onSignatureRequest (optional)

  • Type: onSignatureRequest?: () => void;
  • Default: undefined

Callback function for when the user is requested to sign the transaction.

await mintclub.network('base').airdrop.createAirdrop({
	 onSignatureRequest: () => {} 
})

onSigned (optional)

  • Type: onSigned?: (txHash: '0x${string}') => void;
  • Default: undefined

Callback function for when the user is signs the transaction.

await mintclub.network('base').airdrop.createAirdrop({
	 onSigned: (txHash) => {} 
})

onSuccess (optional)

  • Type: onSuccess?: (receipt: TransactionReceipt) => void;
  • Default: undefined

Callback function for when the transaction is successful.

await mintclub.network('base').airdrop.createAirdrop({
     onSuccess: (receipt) => {} 
})

onError (optional)

  • Type: onError?: (error: unknown) => void;
  • Default: undefined

Callback function for when the transaction fails. This also includes when the user rejects the transaction.

await mintclub.network('base').airdrop.createAirdrop({
	  onError: (error) => {} 
})