useSetUpRecovery

Description

This hook allows you to set up the recovery module.

Parameters

type SetUpRecoveryModuleParams = {
    passKeyName?: string;
    webAuthnOptions?: webAuthnOptions;
    rpcUrl?: string;
};

Example

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

export const RecoverySetup = () => {
  const {
    setUpRecoveryModule,
    setUpRecoveryModuleAsync,
    isLoading,
    isError,
    error,
    isSuccess,
    data
  } = useSetUpRecoveryModule();

  const handleSetUp = async () => {
    try {
      const result = await setUpRecoveryModuleAsync({
        passKeyName: 'myPassKey',
        rpcUrl: 'https://my-rpc-url.com',
        // other necessary parameters
      });
      console.log('Recovery module set up successfully:', result);
    } catch (error) {
      console.error('Error setting up recovery module:', error);
    }
  };

  return (
    <div>
      <button onClick={handleSetUp} disabled={isLoading}>
        Set Up Recovery Module
      </button>
      {isLoading && <p>Setting up recovery module...</p>}
      {isError && <p>Error: {error?.message}</p>}
      {isSuccess && <p>Recovery module set up successfully. Hash: {data}</p>}
    </div>
  );
};

Last updated