Quick start
Generate a new Solana project using the Phantom Embedded JS Starter template.- npm
- pnpm
- yarn
- bun
Features
- Non-custodial: Full user control of private keys for both injected and embedded wallets.
- Dual provider support: Works with Phantom browser extension or creates embedded wallets.
- Chain-specific APIs: Dedicated interfaces for Solana and Ethereum operations.
- Native transactions: Work with blockchain-native objects, not base64url strings.
- Multi-chain: Solana and Ethereum support with dedicated methods.
- TypeScript: Full type safety for all transaction formats.
- Unified API: Same interface for both injected and embedded providers.
- Multiple auth methods: Google, Apple, and browser extension.
Security
The Phantom Connect Browser SDK connects to existing Phantom user wallets, ensuring:- Users control their own wallets and private keys.
- Users maintain full control of their assets.
- Integration with Phantom’s secure wallet infrastructure.
- No private key handling in your app.
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 providers
The SDK supports multiple authentication providers that you configure via theproviders array:
Available providers
Configuration examples
Injected provider only (browser extension)redirectUrl:
- Must be an existing page/route in your app.
- Must be allowlisted in your Phantom Portal app configuration.
- This is where users will be redirected after completing OAuth authentication.
Installation
Quick start
Injected provider (browser extension)
Embedded provider (multiple auth methods)
Chain-specific APIs
The SDK provides separate interfaces for each blockchain with optimized methods:Solana chain (sdk.solana)
Ethereum chain (sdk.ethereum)
EVM support for Phantom Connect embedded wallets will go live later in 2026.
Auto-Confirm (injected provider only)
The SDK provides Auto-Confirm functionality that allows automatic transaction confirmation for specified chains. This feature is only available when using the injected provider (Phantom browser extension).Extension detection
The SDK provides a function to check if the Phantom browser extension is installed:Wallet discovery
The SDK can discover multiple injected wallets using Wallet Standard for Solana and EIP-6963 for Ethereum. This allows users to choose from any installed wallet that supports the configured address types.Discover wallets
Asynchronously discover all available injected wallets:Get discovered wallets
Get wallets from the internal registry (synchronous):Event handlers
Available events
Using events with autoConnect
Debug configuration
The SDK provides dynamic debug configuration that can be changed at runtime:Debug levels
Available AddressType values
What you can do
Connect to wallets
Learn how to connect to Phantom embedded wallet with vanilla JavaScript
Sign messages
Implement message signing for authentication and verification
Sign and send transactions
Handle transaction signing and broadcasting across blockchains
Starter kits and examples
Framework-agnostic JavaScript examples and templates:Browser SDK demo app
Full-featured vanilla JavaScript example with all SDK features
All examples
Browse all example apps on GitHub
Code recipes
Code snippets and implementation patterns
Interactive sandbox
Test the Phantom Connect Browser SDK in our interactive sandbox
Additional resources
SDK overview
Compare all Phantom SDKs and choose the right one
Phantom Connect
Learn about authentication flows and user experience
JWT authentication
Implement custom JWT-based authentication