Connected to {wc.walletName}
+ )} + > + ); +} +``` + +## useWizardConnect + +The `useWizardConnect` hook manages the full relay lifecycle: + +1. **`connect()`** — calls `initiateDappRelay()`, creates a `DappConnectionManager`, and returns + the connection URI for QR display. +2. **Key exchange** — listens for `keyexchangecomplete` and persists the wallet's public key to + localStorage for auto-reconnect. +3. **`walletready`** — updates `state` to `"connected"` and populates `walletName`/`walletIcon`. +4. **Auto-reconnect** — on mount, checks localStorage for a stored session with a `walletPublicKey` + and automatically reconnects. +5. **`disconnect()`** — sends a courtesy disconnect, cleans up the relay, and clears session storage. + +### Return value + +```typescript +interface UseWizardConnectResult { + state: "idle" | "connecting" | "connected" | "disconnected"; + manager: DappConnectionManager | null; + uri: string | null; + qrUri: string | null; + walletName: string | null; + walletIcon: string | null; + connect: () => boolean; + disconnect: () => Promise+ {subtitle} +
+ + {/* QR container */} ++ {uri} +
+ +