Skip to main content

useClaimToken() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to claim tokens on your

Example

const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: claimTokens,
isLoading,
error,
} = useClaimToken(contract);

if (error) {
console.error("failed to claim tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => claimTokens({ to: "0x...", amount: 100 })}
>
Claim Tokens!
</button>
);
};

Signature:

export declare function useClaimToken(
contract: RequiredParam<TokenContract>,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
ClaimTokenParams,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TokenContract>an instance of a TokenContract

Returns:

import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data">, unknown, ClaimTokenParams, unknown>

a mutation object that can be used to tokens to the wallet specificed in the params