useRevokeVesting
Admin revocation — clears the schedule (revocable variants only) and returns funds.
@tokenops/sdk/fhe-vesting/react{ mutate, mutateAsync, isPending, error, data }Description
Revoke a vesting.
Requires REVOKER_ROLE; the schedule must be revocable and not yet ended.
The recipient keeps what vested up to now; the unvested remainder stays in
the manager, released from reserves, and is withdrawn with withdrawAdmin
(WITHDRAWER_ROLE).
After success, invalidate useVestingInfo({ vestingId }), and re-run
useAccessClaimableAmount / useAccessSettledAmount for that vestingId (they are
mutations that submit a transaction, so there is nothing to invalidate) to get
fresh handles.
Signature
function useRevokeVesting(options: ManagerHookOptions): UseMutationResult<Hex, Error, UseRevokeVestingArgs>;Parameters
Shape of the object you pass to .mutate(args).
| Property | Type | Description |
|---|---|---|
| vestingIdrequired | Hex | |
| account | Account | Address |
Example
"use client";
import { useRevokeVesting } from "@tokenops/sdk/fhe-vesting/react";
export function Example() {
const { mutate, isPending } = useRevokeVesting();
return (
<button disabled={isPending} onClick={() => mutate(/* args */)}>
{isPending ? "Sending…" : "RevokeVesting"}
</button>
);
}Auto-generated from the hook's shape (the SDK doesn't carry a TSDoc @example here yet).
Errors
This mutation can reject with SDK-level, product-level, or generic-fallback errors. Product classes carry the offending value as fields — render them inline instead of a generic "transaction failed." See Vesting 2.0 › Errors for the per-class recovery table.
Invalidation recipe
After this mutation succeeds, invalidate the queries it affects so consumer UI re-fetches fresh state. The SDK never auto-invalidates — that's a consumer decision (different apps cache different shapes).
import { useQueryClient } from "@tanstack/react-query";
const queryClient = useQueryClient();
const revokeVesting = useRevokeVesting(/* options */);
revokeVesting.mutate(args, {
onSuccess() {
// Coarse invalidation: refresh every cached read on this product surface.
queryClient.invalidateQueries({
queryKey: ["tokenops-sdk", "fhe-vesting"],
});
},
});See also
Other Write hooks in vesting 2.0:
useCreateVestingOpen a new vesting schedule on a manager — encrypts the amount client-side, submits the tx.useClaimRecipient-side claim. For FeeType.Gas managers pass value (read it with useManagerFeeInfo); omit value for FeeType.DistributionToken.usePartialClaimClaim less than the unlocked amount — leaves the remainder encrypted on the clone.useSplitVestingSplit one vesting into two with custom proportions; both stay encrypted.