A comprehensive suite of SDKs for integrating Phantom Wallet across different platforms and use cases, supporting both Phantom browser extension and embedded non-custodial wallets.
Choose based on your integration model:
Use Server SDK - App developers can programmatically create wallets and execute transactions from backend
Use Frontend SDKs - Connect to existing Phantom user wallets (funded, with history)
Use Frontend SDKs - Create fresh wallets per app (empty, app-specific)
- React SDK - React hooks and components
- React UI - Complete UI solution with pre-built modals
- Browser SDK - Vanilla JavaScript/TypeScript
- React Native SDK - Mobile app integration
All packages with links to documentation:
- @phantom/react-sdk - React hooks and components (NPM)
- @phantom/browser-sdk - Core browser SDK (NPM)
- @phantom/server-sdk - Server-side SDK (NPM)
- @phantom/react-ui - React UI components
- @phantom/client - HTTP client library
- @phantom/api-key-stamper - API authentication
- @phantom/browser-injected-sdk - Browser extension integration
- @phantom/wallet-sdk -
β οΈ DEPRECATED - Use @phantom/browser-sdk or @phantom/react-sdk instead (NPM)
This repository contains multiple SDKs for different integration needs, prioritized by ease of use:
@phantom/react-sdk - React hooks for Phantom integration with native transaction support.
import { PhantomProvider, useConnect, useSignAndSendTransaction, AddressType, NetworkId } from "@phantom/react-sdk";
// App wrapper
<PhantomProvider
config={{
providerType: "embedded",
embeddedWalletType: "app-wallet",
addressTypes: [AddressType.solana],
apiBaseUrl: "https://api.phantom.app/v1/wallets",
organizationId: "your-org-id",
}}
>
<App />
</PhantomProvider>;
// Component - works with native transaction objects!
function SendTransaction() {
const { connect } = useConnect();
const { signAndSendTransaction } = useSignAndSendTransaction();
const handleSend = async () => {
await connect();
const transaction = new Transaction().add(/* your instructions */);
await signAndSendTransaction({
networkId: NetworkId.SOLANA_MAINNET,
transaction, // Native Solana Transaction object!
});
};
}
@phantom/browser-sdk - Core browser SDK with unified interface for Phantom extension and embedded wallets.
import { BrowserSDK, NetworkId, AddressType } from "@phantom/browser-sdk";
const sdk = new BrowserSDK({
providerType: "embedded", // or 'injected' for browser extension
embeddedWalletType: "app-wallet",
addressTypes: [AddressType.solana],
apiBaseUrl: "https://api.phantom.app/v1/wallets",
organizationId: "your-org-id",
});
await sdk.connect();
await sdk.signAndSendTransaction({
networkId: NetworkId.SOLANA_MAINNET,
transaction: solanaTransaction, // Native transaction objects
});
@phantom/server-sdk - Server-side SDK for backend applications with built-in authentication.
import { ServerSDK, NetworkId } from "@phantom/server-sdk";
const sdk = new ServerSDK({
organizationId: process.env.ORGANIZATION_ID,
apiPrivateKey: process.env.PRIVATE_KEY,
apiBaseUrl: process.env.API_URL,
});
// Create wallet
const wallet = await sdk.createWallet("User Wallet");
// Sign messages
const signature = await sdk.signMessage({
walletId: wallet.walletId,
message: "Hello from Phantom!",
networkId: NetworkId.SOLANA_MAINNET,
});
// Sign transactions - supports multiple formats
// Solana Web3.js Transaction
const solanaTransaction = new Transaction().add(/* instructions */);
await sdk.signAndSendTransaction({
walletId: wallet.walletId,
transaction: solanaTransaction, // Native Solana transaction object
networkId: NetworkId.SOLANA_MAINNET,
});
// Ethereum/EVM transaction object
const evmTransaction = {
to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E",
value: 1000000000000000000n,
data: "0x",
};
await sdk.signAndSendTransaction({
walletId: wallet.walletId,
transaction: evmTransaction, // Viem/Ethers transaction object
networkId: NetworkId.ETHEREUM_MAINNET,
});
// Raw bytes or hex strings
await sdk.signAndSendTransaction({
walletId: wallet.walletId,
transaction: "0x01020304", // Hex string
networkId: NetworkId.ETHEREUM_MAINNET,
});
@phantom/react-ui - Pre-built React UI components with automatic modal injection.
import { PhantomUIProvider, useSignAndSendTransaction } from "@phantom/react-ui";
// App wrapper - includes react-sdk + UI theme
<PhantomUIProvider
config={{
providerType: "embedded",
addressTypes: [AddressType.solana],
apiBaseUrl: "https://api.phantom.app/v1/wallets",
organizationId: "your-org-id",
}}
theme="dark"
>
<App />
</PhantomUIProvider>;
// Component - UI appears automatically
function SendTransaction() {
const { signAndSendTransaction } = useSignAndSendTransaction();
const send = async () => {
// Connection/transaction modals appear automatically
await signAndSendTransaction({
networkId: NetworkId.SOLANA_MAINNET,
transaction: solanaTransaction,
});
};
}
@phantom/client - Low-level HTTP client for Phantom's API with authentication support.
@phantom/api-key-stamper - Ed25519 authentication for API requests.
@phantom/browser-injected-sdk - Direct integration with Phantom browser extension.
You can find example applications in the examples/
folder:
Phantom SDKs are in active development and will be prioritizing features requested by early adopters. If you are interested in working with us, please email us at [email protected]
or message @brianfriel
on Telegram.
The embedded wallet is a beta version, and Phantom will not be liable for any losses or damages suffered by you or your end users.
Any suggestions, enhancement requests, recommendations, or other feedback provided by you regarding the embedded wallet will be the exclusive property of Phantom. By using this beta version and providing feedback, you agree to assign any rights in that feedback to Phantom.