Skip to content

cancelAirdrop

Cancel an airdrop. This will refund the airdrop amount to the airdrop creator.

Usage

example.tsx
import { mintclub } from 'mint.club-v2-sdk'
import { useWalletClient } from 'wagmi'
import { base } from 'viem/chains'
 
function CancelAirdropExample() {
  const { data: walletClient } = useWalletClient()
 
  const handleCancelAirdrop = async () => {
    await mintclub
      .withWalletClient({
        ...walletClient,
        chain: base,
      } as any)
      .network('base')
      .airdrop
      .cancelAirdrop({
        airdropId: 1,
      })
  }
 
  return <button onClick={handleCancelAirdrop}>Cancel Airdrop</button>
}

Return Value

Promise<TransactionReceipt>

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

Parameters

airdropId

  • Type: number

Airdrop id.

example.ts
import { mintclub, wei } from 'mint.club-v2-sdk'
 
await mintclub.network('base').airdrop.cancelAirdrop({
  airdropId: 1, 
})

onSignatureRequest (optional)

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

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

await mintclub.network('base').airdrop.cancelAirdrop({
  airdropId: 1,
  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.cancelAirdrop({
  airdropId: 1,
  onSigned: (txHash) => {}, 
})

onSuccess (optional)

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

Callback function for when the transaction is successful.

await mintclub.network('base').airdrop.cancelAirdrop({
  airdropId: 1,
  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.cancelAirdrop({
  airdropId: 1,
  onError: (error) => {}, 
})