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.
@phantom/wallet-sdk (the embedded wallet SDK) is now deprecated. Future development and support will focus on the following packages:
- @phantom/browser-sdk: Core browser SDK for Phantom wallet integration (no UI components).
- @phantom/react-sdk: Invisible SDK for non custodial client wallets
- @phantom/react-ui: SDK with React UI components
- @phantom/server-sdk: Server SDK for custodial server wallets
- @phantom/browser-injected-sdk: Direct SDK to interface with the Phantom browser extension
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.com',
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.com',
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
});
const wallet = await sdk.createWallet('User Wallet');
const signature = await sdk.signMessage(
wallet.walletId,
'Hello from Phantom!',
NetworkId.SOLANA_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.com',
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.
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) - Legacy embedded wallet SDK
- @phantom/browser-embedded-sdk (DEPRECATED) - Legacy browser embedded SDK
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 developers@phantom.app
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.