phantom-connect
Phantom Connect SDK
Build wallet-connected Solana applications with the Phantom Connect SDK ecosystem.
SDK Selection
| Platform | SDK | Package |
|---|---|---|
| React web apps | React SDK | @phantom/react-sdk |
| React Native / Expo | React Native SDK | @phantom/react-native-sdk |
| Vanilla JS / Vue / Angular | Browser SDK | @phantom/browser-sdk |
Prerequisites
- Phantom Portal Account — Register at phantom.com/portal
- App ID — Get from Portal → App → Set Up
- Allowlisted URLs — Add domains and redirect URLs in Portal
Auth Providers
| Provider | Description | Requires appId |
|---|---|---|
"injected" |
Phantom browser extension | No |
"google" |
Google OAuth (embedded wallet) | Yes |
"apple" |
Apple ID (embedded wallet) | Yes |
Critical Rules
- Always use
signAndSendTransaction—signTransactionandsignAllTransactionsare NOT supported for embedded wallets - Always use
LAMPORTS_PER_SOLfrom@solana/web3.jsfor amount conversion — never hardcode1000000000 - Wrap all async SDK calls in try-catch — users can reject prompts at any time
- Check
isConnectedbefore signing — verify wallet connection before any operation - React Native:
react-native-get-random-valuesmust be the FIRST import — before any other imports - BrowserSDK must be a singleton — create one instance per app, never multiple
- Import
AddressTypefrom@phantom/browser-sdkonly - Use devnet for testing, mainnet-beta for production — never test against mainnet with real funds
- Never expose private keys — Phantom handles all signing internally
- Embedded wallet spending limit: $1,000 USD per day per app per user
- Social login sessions persist 7 days from last auth event — handle expiration gracefully
Quick Start
React SDK
import { PhantomProvider, useModal, usePhantom, darkTheme } from "@phantom/react-sdk";
import { AddressType } from "@phantom/browser-sdk";
function App() {
return (
<PhantomProvider
config={{
providers: ["google", "apple", "injected"],
appId: "your-app-id",
addressTypes: [AddressType.solana],
authOptions: { redirectUrl: "https://yourapp.com/callback" },
}}
theme={darkTheme}
>
<YourApp />
</PhantomProvider>
);
}
React Native SDK
// CRITICAL: Must be first import
import "react-native-get-random-values";
import { PhantomProvider, AddressType, darkTheme } from "@phantom/react-native-sdk";
// Requires app.json: { "expo": { "scheme": "myapp", "plugins": [...] } }
Browser SDK
import { BrowserSDK, AddressType } from "@phantom/browser-sdk";
const sdk = new BrowserSDK({
providers: ["google", "apple", "injected"],
appId: "your-app-id",
addressTypes: [AddressType.solana],
autoConnect: true,
});
Reference Docs
For detailed implementation patterns, read these files:
- references/react-sdk.md — Complete React SDK reference (hooks, components, theming)
- references/react-native-sdk.md — Mobile setup, Expo config, deep links
- references/browser-sdk.md — Vanilla JS patterns, events, wallet discovery
- references/transactions.md — Solana transaction patterns (SOL, SPL tokens)
- references/payments.md — Crypto payment flows (SOL, USDC, backend verification)
- references/token-gating.md — Token-gated access (client-side, server-side, NFT)
- references/nft-minting.md — NFT mint pages, Metaplex Core, compressed NFTs
Common Issues
| Issue | Solution |
|---|---|
| "appId required" | Add appId from Phantom Portal when using google/apple providers |
| Redirect not working | Allowlist redirectUrl in Phantom Portal |
| React Native crashes | Import react-native-get-random-values as FIRST import |
| Extension not detected | Use waitForPhantomExtension() with timeout |
signTransaction error |
Use signAndSendTransaction instead — embedded wallets don't support signTransaction |
Resources
- Phantom Portal — App registration
- Phantom Docs — Full documentation
- SDK Examples — Working demos
- MCP Server — AI docs access
More from sendaifun/skills
helius
Build Solana applications with Helius infrastructure. Covers transaction sending (Sender), asset/NFT queries (DAS API), real-time streaming (WebSockets, Laserstream), event pipelines (webhooks), priority fees, wallet analysis, and agent onboarding.
215solana-kit
Complete guide for @solana/kit - the modern, tree-shakeable, zero-dependency JavaScript SDK from Anza. Covers RPC connections, signers, transaction building with pipe, signing, sending, and account fetching with full TypeScript support.
202pumpfun
Complete PumpFun Protocol guide for building token launches, bonding curves, and AMM integrations on Solana. Covers Pump Program (token creation, buy/sell on bonding curves), PumpSwap AMM (liquidity pools, swaps), fee structures, creator fees, and SDK integration.
165meteora
Complete Meteora DeFi SDK suite for building liquidity pools, AMMs, bonding curves, vaults, token launches, and zap operations on Solana. Use when integrating DLMM, DAMM v2, DAMM v1, Dynamic Bonding Curves, Alpha Vaults, Zap, or Stake-for-Fee functionality.
164vulnhunter
Security vulnerability detection and variant analysis skill. Use when hunting for dangerous APIs, footgun patterns, error-prone configurations, and vulnerability variants across codebases. Combines sharp edges detection with variant hunting methodology.
145raydium
Complete Raydium Protocol SDK - the single source of truth for integrating Raydium on Solana. Covers SDK, Trade API, CLMM, CPMM, AMM pools, LaunchLab token launches, farming, CPI integration, and all Raydium tools.
144