This monorepo contains the Phantom Wallet SDKs and demo applications.
@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: React wrapper for the browser SDK, providing hooks and components for easy integration.
- @phantom/browser-sdk: Core browser SDK for Phantom wallet functionality. NPM
- @phantom/react-sdk: React hooks and components for Phantom wallet. NPM
- @phantom/wallet-sdk (DEPRECATED): Embedded wallet SDK with UI (no longer maintained).
You can find example applications in the examples/
folder:
npm install @phantom/browser-sdk
# or
yarn add @phantom/browser-sdk
import { createPhantom } from "@phantom/browser-sdk";
import { createSolanaPlugin } from "@phantom/browser-sdk/solana";
const phantom = createPhantom({
chainPlugins: [createSolanaPlugin()],
});
// Example: connect to wallet
const connect = async () => {
const result = await phantom.solana.connect();
console.log("Connected address:", result.address);
};
See the @phantom/browser-sdk README for more details and API reference.
npm install @phantom/react-sdk @phantom/browser-sdk
# or
yarn add @phantom/react-sdk @phantom/browser-sdk
import React from "react";
import { PhantomProvider, useConnect } from "@phantom/react-sdk";
import { createSolanaPlugin } from "@phantom/browser-sdk/solana";
function App() {
return (
<PhantomProvider config={{ chainPlugins: [createSolanaPlugin()] }}>
<WalletComponent />
</PhantomProvider>
);
}
function WalletComponent() {
const { connect } = useConnect();
const handleConnect = async () => {
try {
const connectedAccount = await connect();
console.log("Wallet connected:", connectedAccount?.publicKey?.toString());
} catch (error) {
console.error("Connection failed:", error);
}
};
return <button onClick={handleConnect}>Connect to Solana</button>;
}
See the @phantom/react-sdk README for more details and API reference.
# Install dependencies
yarn install
# Build all packages
yarn build
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.