useGetRecoveryRequest

Description

This hook allows you to query a recovery request.

Parameters

type GetRecoveryRequestParams = {
    rpcUrl?: string;
};

Example

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

export const RecoveryRequestStatus = () => {
  const { data, isLoading, isError, error } = useGetRecoveryRequest({
    rpcUrl: 'https://my-rpc-url.com',
  });

  if (isLoading) return <p>Loading recovery request status...</p>;
  if (isError) return <p>Error: {error?.message}</p>;

  return (
    <div>
      {data ? (
        <>
          <p>Recovery Request Active</p>
          <p>New Owner: {data.newOwner}</p>
          <p>Execution Time: {new Date(data.executionTime * 1000).toLocaleString()}</p>
        </>
      ) : (
        <p>No active recovery request</p>
      )}
    </div>
  );
};

Last updated