Skip to main content

useTokenDrop() function

Warning: This API is now obsolete.

This hook is deprecated and will be removed in a future major version. You should use instead.

- const token = await sdk.useTokenDrop("0x1234...");
+ const token = await sdk.useContract("0x1234...", "token-drop").contract;

Hook for getting an instance of a Token Drop contract.

Example

import { useTokenDrop } from '@thirdweb-dev/react'

export default function Component() {
const tokenDrop = useTokenDrop("<YOUR-CONTRACT-ADDRESS>")

// Now you can use the token drop contract in the rest of the component

// For example, this function will get the connected wallets token balance
async function balance() {
const balance = await tokenDrop.balance()
return balance
}

...
}

Signature:

export declare function useTokenDrop(
contractAddress: RequiredParam<string>,
): import("@thirdweb-dev/sdk").TokenDrop | undefined;

Parameters

ParameterTypeDescription
contractAddressRequiredParam<string>the address of the Token Drop contract, found in your thirdweb dashboard

Returns:

import("@thirdweb-dev/sdk").TokenDrop | undefined