import type { WalletChain } from '../../../errors/wallet.js'; import type { OTPResponse } from '../../../shared/hooks/useRecoveryOTP.js'; import type { CreateEmbeddedWalletOptions, CreateEmbeddedWalletResult } from '../../../shared/types.js'; import type { SetRouteOptions } from '../../Openfort/types.js'; type OtpStatus = 'idle' | 'loading' | 'error' | 'success'; type AutomaticRecoveryOptions = { /** Chain family this flow creates a wallet on, used to label the debug logs. */ chain: WalletChain; /** Chain-specific embedded wallet creation call. */ create: (options?: CreateEmbeddedWalletOptions) => Promise; /** Route to move to once the wallet exists. */ successRoute: SetRouteOptions; /** Copy shown when a submitted code is rejected without a typed Openfort error. */ otpVerificationError: string; /** Blocks creation while a competing SDK operation is in flight. */ canCreate: boolean; }; export type AutomaticRecovery = { /** Failure that stopped the flow, rendered by the caller's loader. */ recoveryError: Error | null; /** A creation attempt has been requested or is in flight. */ shouldCreate: boolean; /** The recovery share is gated behind a code the user has to type. */ needsOTP: boolean; /** Where the code was sent, once one has been requested. */ otpResponse: OTPResponse | null; otpStatus: OtpStatus; /** Copy for a rejected code, shown under the input. */ otpError: string | false; submitOtp: (otp: string) => Promise; resend: { onClick: () => void; disabled: boolean; label: string; }; /** Requests a creation attempt, clearing any previous failure. */ startCreation: () => void; }; /** * Drives automatic wallet recovery: it creates the embedded wallet, turns the * `OTP_REQUIRED` outcome into a one-time-code request, and verifies the code the * user types by retrying creation with it. */ export declare function useAutomaticRecovery({ chain, create, successRoute, otpVerificationError, canCreate, }: AutomaticRecoveryOptions): AutomaticRecovery; export {};