一键导入
setup-react-native-app
Scaffold a React Native (Expo) app with Phantom React Native SDK for mobile wallet integration, including polyfills and deep linking
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a React Native (Expo) app with Phantom React Native SDK for mobile wallet integration, including polyfills and deep linking
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build wallet-connected applications with the Phantom Connect SDK for Solana. Use when integrating Phantom wallets into React, React Native, or vanilla JS/TS apps — including wallet connection, social login (Google/Apple), transaction signing, message signing, token-gated access, crypto payments, and NFT minting. Covers @phantom/react-sdk, @phantom/react-native-sdk, and @phantom/browser-sdk.
Configure Google and Apple social login with Phantom Connect SDK to enable embedded wallet creation
Build and send SOL transfers with Phantom Connect SDK, including transaction construction, signing, and verification
Scaffold a vanilla JS/TS app with Phantom Browser SDK for wallet integration, without any framework dependency
Scaffold a React app with Phantom Connect SDK for wallet integration, including social login and Solana support
Implement message signing with Phantom Connect SDK for Solana and EVM, including Sign-in with Solana (SIWS) authentication
| name | setup-react-native-app |
| description | Scaffold a React Native (Expo) app with Phantom React Native SDK for mobile wallet integration, including polyfills and deep linking |
npx expo install @phantom/react-native-sdk react-native-get-random-values @expo/browser expo-web-browser expo-crypto
In your app's entry file (e.g. App.tsx or index.ts), add this as the very first import:
import "react-native-get-random-values"; // MUST be the first import
import { PhantomProvider } from "@phantom/react-native-sdk";
// ... other imports
This is non-negotiable. The polyfill must execute before any other code that uses crypto.
app.jsonAdd the custom URL scheme and required plugins:
{
"expo": {
"scheme": "your-app-scheme",
"plugins": [
[
"expo-web-browser"
]
]
}
}
import "react-native-get-random-values";
import { PhantomProvider } from "@phantom/react-native-sdk";
export default function App() {
return (
<PhantomProvider
config={{
appId: "your-app-id-from-phantom-portal",
providers: ["google", "apple"],
addressTypes: ["solana"],
scheme: "your-app-scheme",
redirectUrl: "your-app-scheme://callback",
}}
>
<YourApp />
</PhantomProvider>
);
}
Mobile-specific config fields:
scheme — Your app's custom URL scheme, must match app.json.redirectUrl — Deep link URL using your custom scheme for OAuth callbacks.The hooks API is identical to @phantom/react-sdk:
import {
useConnect,
useAccounts,
useDisconnect,
useSolana,
} from "@phantom/react-native-sdk";
function WalletScreen() {
const { connect, isConnected } = useConnect();
const { accounts } = useAccounts();
const { disconnect } = useDisconnect();
const handleConnect = async () => {
try {
await connect();
} catch (error) {
console.error("Connection failed:", error);
}
};
if (!isConnected) {
return <Button title="Connect" onPress={handleConnect} />;
}
const solanaAccount = accounts.find((a) => a.chain === "solana");
return (
<View>
<Text>Address: {solanaAccount?.address}</Text>
<Button title="Disconnect" onPress={disconnect} />
</View>
);
}
react-native-get-random-values MUST be the very first import in your entry file.signAndSendTransaction — signTransaction is NOT supported for embedded wallets.scheme in PhantomProvider config must match the scheme in app.json.appId.