mcpField
P
phantom-connect

phantom-connect

github.com/sendaifunDevelopment130115 installsUpdated 13w ago
Repository

About phantom-connect

phantom-connect is an integration guide for the Phantom Connect SDK ecosystem. It helps developers build Solana wallet-connected apps across React, React Native, and browser environments, with guidance on social login and extension wallets.

Key features

  1. 01React, React Native, and browser SDKs
  2. 02Google, Apple, and Phantom extension providers
  3. 03Wallet connection and transaction signing
  4. 04References for payments, token gating, and NFT minting

Use cases

  1. 01Add Phantom wallet access to a React app
  2. 02Integrate embedded wallets in an Expo app
  3. 03Build SOL or USDC payment flows
  4. 04Create token-gated pages or NFT mint pages

MCP support

The README mentions an MCP Server for AI documentation access but does not describe its specific functions.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/sendaifun/skills --skill phantom-connect

After installing, type/phantom-connectin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
browser-sdk.md
nft-minting.md
payments.md
react-native-sdk.md
react-sdk.md
token-gating.md
transactions.md

Details

From the project README

Phantom Connect SDK

Build wallet-connected Solana applications with the Phantom Connect SDK ecosystem.

SDK Selection

PlatformSDKPackage
React web appsReact SDK@phantom/react-sdk
React Native / ExpoReact Native SDK@phantom/react-native-sdk
Vanilla JS / Vue / AngularBrowser SDK@phantom/browser-sdk

Prerequisites

  1. Phantom Portal Account — Register at phantom.com/portal
  2. App ID — Get from Portal → App → Set Up
  3. Allowlisted URLs — Add domains and redirect URLs in Portal

Auth Providers

ProviderDescriptionRequires appId
"injected"Phantom browser extensionNo
"google"Google OAuth (embedded wallet)Yes
"apple"Apple ID (embedded wallet)Yes

Critical Rules

  1. Always use signAndSendTransaction — signTransaction and signAllTransactions are NOT supported for embedded wallets
  2. Always use LAMPORTS_PER_SOL from @solana/web3.js for amount conversion — never hardcode 1000000000
  3. Wrap all async SDK calls in try-catch — users can reject prompts at any time
  4. Check isConnected before signing — verify wallet connection before any operation
  5. React Native: react-native-get-random-values must be the FIRST import — before any other imports
  6. BrowserSDK must be a singleton — create one instance per app, never multiple
  7. Import AddressType from @phantom/browser-sdk only
  8. Use devnet for testing, mainnet-beta for production — never test against mainnet with real funds
  9. Never expose private keys — Phantom handles all signing internally
  10. Embedded wallet spending limit: $1,000 USD per day per app per user
  11. 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:

Common Issues

IssueSolution
"appId required"Add appId from Phantom Portal when using google/apple providers
Redirect not workingAllowlist redirectUrl in Phantom Portal
React Native crashesImport react-native-get-random-values as FIRST import
Extension not detectedUse waitForPhantomExtension() with timeout
signTransaction errorUse signAndSendTransaction instead — embedded wallets don't support signTransaction

Resources

Comments

Markdown supported