useCancelRecoveryRequest

Description

This hook allows you to cancel a recovery request.

Parameters

type CancelRecoveryRequestParams = {
    rpcUrl?: string;
};

Example

import { useCancelRecoveryRequest } from "@/hooks/useCancelRecoveryRequest";

export const CancelRecoveryButton = () => {
  const {
    cancelRecoveryRequest,
    cancelRecoveryRequestAsync,
    isLoading,
    isError,
    error,
    isSuccess,
    data
  } = useCancelRecoveryRequest();

  const handleCancel = async () => {
    try {
      const result = await cancelRecoveryRequestAsync({
        rpcUrl: 'https://my-rpc-url.com',
      });
      console.log('Recovery request canceled successfully:', result);
    } catch (error) {
      console.error('Error canceling recovery request:', error);
    }
  };

  return (
    <div>
      <button onClick={handleCancel} disabled={isLoading}>
        Cancel Recovery Request
      </button>
      {isLoading && <p>Canceling recovery request...</p>}
      {isError && <p>Error: {error?.message}</p>}
      {isSuccess && <p>Recovery request canceled successfully. Hash: {data}</p>}
    </div>
  );
};

Last updated