Function useTransferToken

  • Beta

    Transfer tokens to a specific wallet

    Parameters

    Returns UseMutationResult<Omit<{
        data: (() => Promise<unknown>);
        receipt: providers.TransactionReceipt;
    }, "data">, unknown, TokenParams, unknown>

    a mutation object that can be used to transfer tokens

    Example

    const Component = () => {
    const { contract } = useContract("{{contract_address}}");
    const {
    mutate: transferTokens,
    isLoading,
    error,
    } = useTransferToken(contract);

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

    return (
    <button
    disabled={isLoading}
    onClick={() => transferTokens({ to: "{{wallet_address}}", amount: 1000 })}
    >
    Transfer
    </button>
    );
    };

    Twfeature

    ERC20

    See

    Documentation

Generated using TypeDoc