Features
- Built for React: Provides React hooks (
usePhantom,useModal) and a provider component for app-level configuration. - Multi-chain support: Solana (available now), other chains coming soon.
- Connection modal: Built-in, customizable modal for connecting users to Phantom.
- Flexible authentication providers: OAuth (Google, Apple), browser extension, and injected providers.
- User wallet integration: Connects to existing Phantom user wallets using Phantom Connect.
- TypeScript support: Fully typed API surface.
Security
The Phantom Connect React SDK connects to existing Phantom user wallets, ensuring:- Users control their own wallets and private keys.
- Integration with Phantom’s secure wallet infrastructure.
- No private key handling in your application.
- User maintains full control of their assets.
Prerequisites
- Register your app: Sign up or log in to the Phantom Portal and register your app.
- Obtain your App ID:
- In Phantom Portal, expand your app in the left navigation, then select Set Up.
- Your App ID appears at the top of the page.
- Allowlist your domains and redirect URLs: Add your app’s domains and redirect URLs in the Phantom Portal to enable wallet connections.
Authentication configuration
When using OAuth providers (google, apple), you’ll need to configure authentication options:redirectUrl:
- Must be an existing page/route in your application
- Must be whitelisted in your Phantom Portal app configuration
- This is where users will be redirected after completing OAuth authentication
- Required for google and apple providers
- Not required for injected provider
Installation
Dependencies
Install additional dependencies based on the networks you want to support:| Network support | Required dependencies |
|---|---|
| Solana | @solana/web3.js OR @solana/kit |
| Ethereum/EVM | viem |
Quick start
Connection Modal
The SDK includes a built-in connection modal UI that provides a user-friendly interface for connecting to Phantom. The modal supports multiple connection methods (Google, Apple, browser extension) and handles all connection logic automatically.Using the Modal with useModal Hook
To use the modal, pass atheme prop to PhantomProvider and use the useModal() hook to control visibility:
- Multiple Auth Providers: Google, Apple, browser extension
- Automatic Provider Detection: Shows browser extension option when Phantom is installed
- Mobile Support: Displays deeplink option for Phantom mobile app on mobile devices
- Error Handling: Clear error messages displayed in the modal
- Loading States: Visual feedback during connection attempts
- Responsive Design: Optimized for both mobile and desktop
ConnectButton Component
A ready-to-use button component that handles the complete connection flow:- When disconnected: Opens connection modal with auth provider options
- When connected: Displays truncated address and opens wallet management modal
- Uses theme styling for consistent appearance
ConnectBox component
An inline embedded component that displays the connection UI directly in your page layout (without a modal backdrop). Perfect for auth callback pages or when you want a more integrated connection experience. The component automatically handles all connection states including loading, error, and success during the auth callback flow.
| Property | Type | Default | Description |
|---|---|---|---|
maxWidth | string | number | "350px" | Maximum width of the box |
transparent | boolean | false | Removes background, border, and shadow for a transparent appearance |
appIcon | string | — | URL to your app icon (optional, can also be set via PhantomProvider) |
appName | string | — | Your app name (optional, can also be set via PhantomProvider) |
- Inline embedded: Renders directly in page flow (not as a floating modal)
- Auto state management: Automatically shows connection/login UI when disconnected, wallet info when connected
- Auth callback support: Handles loading and error states during OAuth callback flows
- No close button: Designed for embedded use cases where users shouldn’t dismiss the UI
- Theme-aware: Uses your configured theme for consistent styling
Theming
The SDK includes pre-built themes and supports full customization to match your app’s design.Pre-built themes
Use the includeddarkTheme or lightTheme:
Custom themes
Create a custom theme object to fully control the modal’s appearance:| Property | Description | Example |
|---|---|---|
background | Modal background color | "#1a1a1a" |
text | Primary text color | "#ffffff" |
secondary | Secondary text, borders, and dividers | "#98979C" |
brand | Brand/primary action color | "#ab9ff2" |
error | Error state color | "#ff4444" |
success | Success state color | "#00ff00" |
borderRadius | Border radius for buttons and modal | "16px" |
overlay | Modal overlay background (supports opacity) | "rgba(0, 0, 0, 0.8)" |
Chain-Specific Hooks
The React SDK provides dedicated hooks for each blockchain:useSolana hook
useEthereum hook
EVM support for Phantom Connect embedded wallets will go live later in 2026.
| Network | Chain ID | Usage |
|---|---|---|
| Ethereum Mainnet | 1 | ethereum.switchChain(1) |
| Ethereum Sepolia | 11155111 | ethereum.switchChain(11155111) |
| Polygon Mainnet | 137 | ethereum.switchChain(137) |
| Polygon Amoy | 80002 | ethereum.switchChain(80002) |
| Base Mainnet | 8453 | ethereum.switchChain(8453) |
| Base Sepolia | 84532 | ethereum.switchChain(84532) |
| Arbitrum One | 42161 | ethereum.switchChain(42161) |
| Arbitrum Sepolia | 421614 | ethereum.switchChain(421614) |
| Monad Mainnet | 143 | ethereum.switchChain(143) |
| Monad Testnet | 10143 | ethereum.switchChain(10143) |
Auto-Confirm Hook (Injected Provider Only)
The SDK provides auto-confirm functionality that allows automatic transaction confirmation for specified chains.useAutoConfirm hook
Wallet Discovery Hook
useDiscoveredWallets
Get discovered injected wallets with automatic loading and error states. Discovers wallets using Wallet Standard (Solana) and EIP-6963 (Ethereum) standards.| Property | Type | Description |
|---|---|---|
wallets | InjectedWalletInfo[] | Array of discovered wallet information |
isLoading | boolean | true while discovery is in progress |
error | Error | null | Error object if discovery fails |
refetch | () => Promise<void> | Function to manually refresh the wallet list |
SDK Initialization
The SDK provides anisLoading state to track when initialization and autoconnect are in progress:
Debug Configuration
Configure debug logging by passing adebugConfig prop to PhantomProvider:
| Property | Type | Description |
|---|---|---|
enabled | boolean | Enable debug logging |
level | DebugLevel | Debug level (ERROR, WARN, INFO, DEBUG) |
callback | (message: DebugMessage) => void | Custom debug message handler |
Available hooks
| Hook | Purpose | Returns |
|---|---|---|
useModal | Control the connection modal | { open, close, isOpened } |
usePhantom | Access wallet/user state | { isConnected, isLoading, user, wallet } |
useConnect | Connect to wallet | { connect, isConnecting, isLoading, error } |
useAccounts | Get wallet addresses | WalletAddress[] or null |
useIsExtensionInstalled | Check extension status | { isLoading, isInstalled } |
useDisconnect | Disconnect from wallet | { disconnect, isDisconnecting } |
useAutoConfirm | Auto-confirm management (injected only) | { enable, disable, status, supportedChains, ... } |
useDiscoveredWallets | Get discovered injected wallets | { wallets, isLoading, error, refetch } |
useSolana | Solana chain operations | { solana, isAvailable } |
useEthereum | Ethereum chain operations | { ethereum, isAvailable } |
useTheme | Access current theme | PhantomTheme |
What you can do
Connect to wallets
Learn how to connect to Phantom user wallets with React hooks
Sign messages
Implement message signing for authentication and verification
Sign and send transactions
Handle transaction signing and broadcasting across blockchains
Starter kits and examples
Get started quickly with production-ready React templates:React SDK demo app
Full-featured React example with wallet connection, signing, and transactions
Next.js example
Complete Next.js integration with Phantom React SDK
Wagmi Integration
Use Phantom SDK alongside Wagmi for enhanced Ethereum support
All examples
Browse all example applications on GitHub