Phantom Connect + DFlow Skill
Instructions
Step 1: Identify What the User Wants to Build
Determine the domain, then route to the right references.
Wallet connection and Solana interactions:
- Connecting a Phantom wallet (React, React Native, vanilla JS)
- Signing messages or transactions
- Token-gated access
- NFT minting
- Crypto payments
- Solana transfers (SOL or SPL tokens)
DFlow trading:
- Spot token swaps (imperative or declarative)
- Prediction market discovery, trading, and redemption
- Proof KYC identity verification
Many tasks combine both (e.g., a swap UI needs wallet connection AND DFlow trading). Read all relevant references before writing code.
Step 2: Read the Relevant References
Phantom Connect SDKs (wallet connection, signing, auth):
references/react-sdk.md — React hooks, components, theming, PhantomProvider
references/react-native-sdk.md — Expo config, polyfills, deep links, mobile auth
references/browser-sdk.md — BrowserSDK init, events, wallet discovery, vanilla JS
Solana patterns (transactions, gating, minting, payments):
references/transactions.md — SOL/SPL transfers, signing, fee estimation
references/token-gating.md — client-side and server-side token-gated access
references/nft-minting.md — mint pages, Metaplex Core, compressed NFTs
references/payments.md — SOL/USDC payments, checkout with backend verification
DFlow trading (swaps, prediction markets, KYC):
references/dflow-crypto-trading.md — spot token swaps, imperative vs declarative trades, slippage, priority fees, platform fees
references/dflow-prediction-markets.md — market discovery, trading, redemption, maintenance windows, fee models
references/dflow-websockets.md — real-time price, trade, and orderbook streaming via WebSocket
references/dflow-proof.md — Proof KYC verification (required for prediction market trades, usable for any gated feature)
Step 3: Ask the Right Questions
Before implementing, ask questions based on the domain:
For Phantom Connect tasks:
- Which platform? (React, React Native, vanilla JS)
- Do they need social login (Google/Apple) or extension only?
For DFlow spot trades:
- Imperative or declarative? If unsure, suggest starting with imperative.
- Dev or production endpoints? If production, remind them to apply for an API key at pond.dflow.net/build/api-key.
- Platform fees? If yes, what bps and what fee account?
- Client environment? (web, mobile, backend, CLI)
For DFlow prediction markets:
- Settlement mint? (USDC or CASH — these are the only two)
- Dev or production endpoints? If production, remind them to apply for an API key at pond.dflow.net/build/api-key.
- Platform fees? If yes, use
platformFeeScale for dynamic fees.
- Client environment? (web, mobile, backend, CLI)
Step 4: Implement
Follow the patterns in the reference files. Key rules by domain:
Phantom Connect:
- All SDK details (provider setup, hooks, components, auth providers) are in the SDK reference files. Read them before writing Phantom integration code.
DFlow Trading:
- Dev endpoints (
dev-quote-api.dflow.net, dev-prediction-markets-api.dflow.net, wss://dev-prediction-markets-api.dflow.net/api/v1/ws) work without an API key but are rate-limited. Production requires a key from pond.dflow.net/build/api-key.
- Prediction market trades require Proof KYC before buying or selling outcome tokens. Browsing and discovery do not require KYC.
- Prediction markets also require geoblocking for restricted jurisdictions.
Step 5: Handle Errors
Each reference file contains domain-specific error handling. Key cross-cutting concerns:
- User rejects a transaction or signature request
- Wallet not connected when a signed action is attempted
- DFlow API returns 429 (rate limited) — retry with backoff or get a production API key
route_not_found from DFlow — check amount units (must be atomic), check liquidity, check mint addresses
Examples
Example 1: React wallet connection
User says: "Add Phantom wallet login to my Next.js app"
Actions:
- Read
references/react-sdk.md
- Install
@phantom/react-sdk
- Wrap app in PhantomProvider with desired auth providers and appId
- Use
useModal hook for a connect button
- Use
useAccounts to display the connected wallet address
Result: Working wallet connection with social login and extension support
Example 2: Token-gated page
User says: "Build a page that only BONK holders can see"
Actions:
- Read
references/react-sdk.md and references/token-gating.md
- Set up wallet connection
- Query the BONK token balance for the connected wallet
- Conditionally render content based on balance threshold
- For production: add server-side signature verification
Result: Page that checks wallet token balance and gates content
Example 3: DFlow token swap
User says: "Add a swap feature using DFlow"
Actions:
- Ask: imperative or declarative? Platform fees? Client environment?
- Read
references/dflow-crypto-trading.md
- If unsure on trade type, suggest imperative
/order flow (simpler, synchronous)
- Connect wallet with Phantom, sign and submit transaction to Solana RPC
Result: Working swap UI with DFlow routing
Example 4: Prediction market trade
User says: "Let users buy YES/NO positions on prediction markets"
Actions:
- Ask: settlement mint (USDC or CASH)? Platform fees? Client environment?
- Read
references/dflow-prediction-markets.md and references/dflow-proof.md
- Build market discovery UI from Metadata API
- Gate trades behind Proof KYC verification
- Use /order endpoint to trade settlement mint into outcome tokens
Result: Prediction market UI with KYC-gated trading
Example 5: Swap UI with wallet connection
User says: "Build a full swap page with wallet connect and DFlow"
Actions:
- Ask: which platform? Imperative or declarative swap? Platform fees?
- Read the relevant SDK reference AND
references/dflow-crypto-trading.md
- Set up wallet connection with Phantom
- Build swap form, proxy
/order calls through backend
- Sign transaction with connected wallet, submit to RPC
Result: End-to-end swap page combining Phantom wallet and DFlow trading
Resources
- Phantom Portal: phantom.com/portal
- Phantom Docs: docs.phantom.com
- SDK Examples: github.com/phantom/wallet-sdk/tree/main/examples
- Phantom MCP Server: docs.phantom.com/resources/mcp-server
- DFlow MCP Server: pond.dflow.net/mcp
- DFlow MCP Docs: pond.dflow.net/build/mcp
- DFlow Docs: pond.dflow.net/introduction
- DFlow Cookbook: github.com/DFlowProtocol/cookbook
1---
2name: dflow-phantom-connect
3description: "Build Solana wallet-connected apps with Phantom Connect SDKs and DFlow trading. Use when user asks to connect a Phantom wallet, integrate Phantom in React, React Native, or vanilla JS, sign messages or transactions, build token-gated pages, mint NFTs, accept crypto payments, swap tokens with DFlow, trade prediction markets, or integrate Proof KYC verification. Covers @phantom/react-sdk, @phantom/react-native-sdk, @phantom/browser-sdk, DFlow spot trading, DFlow prediction markets, and DFlow Proof identity verification. Do NOT use for Ethereum or EVM wallet integrations, or non-DFlow DEX routing."
4license: MIT
5metadata:
6 source: https://skillmd.com/skills/solizardking/dflow-phantom-connect
7 author: DFlow & Phantom Connect
8 version: 1.0.0
9 tags: [solana, phantom, wallet, trading, prediction-markets, kyc]
10 mcp-server: pond.dflow.net/mcp
11---
12
13# Phantom Connect + DFlow Skill
14
15## Instructions
16
17### Step 1: Identify What the User Wants to Build
18
19Determine the domain, then route to the right references.
20
21**Wallet connection and Solana interactions:**
22
23- Connecting a Phantom wallet (React, React Native, vanilla JS)
24- Signing messages or transactions
25- Token-gated access
26- NFT minting
27- Crypto payments
28- Solana transfers (SOL or SPL tokens)
29
30**DFlow trading:**
31
32- Spot token swaps (imperative or declarative)
33- Prediction market discovery, trading, and redemption
34- Proof KYC identity verification
35
36Many tasks combine both (e.g., a swap UI needs wallet connection AND DFlow trading). Read all relevant references before writing code.
37
38### Step 2: Read the Relevant References
39
40**Phantom Connect SDKs** (wallet connection, signing, auth):
41
42- `references/react-sdk.md` — React hooks, components, theming, PhantomProvider
43- `references/react-native-sdk.md` — Expo config, polyfills, deep links, mobile auth
44- `references/browser-sdk.md` — BrowserSDK init, events, wallet discovery, vanilla JS
45
46**Solana patterns** (transactions, gating, minting, payments):
47
48- `references/transactions.md` — SOL/SPL transfers, signing, fee estimation
49- `references/token-gating.md` — client-side and server-side token-gated access
50- `references/nft-minting.md` — mint pages, Metaplex Core, compressed NFTs
51- `references/payments.md` — SOL/USDC payments, checkout with backend verification
52
53**DFlow trading** (swaps, prediction markets, KYC):
54
55- `references/dflow-crypto-trading.md` — spot token swaps, imperative vs declarative trades, slippage, priority fees, platform fees
56- `references/dflow-prediction-markets.md` — market discovery, trading, redemption, maintenance windows, fee models
57- `references/dflow-websockets.md` — real-time price, trade, and orderbook streaming via WebSocket
58- `references/dflow-proof.md` — Proof KYC verification (required for prediction market trades, usable for any gated feature)
59
60### Step 3: Ask the Right Questions
61
62Before implementing, ask questions based on the domain:
63
64**For Phantom Connect tasks:**
65
66- Which platform? (React, React Native, vanilla JS)
67- Do they need social login (Google/Apple) or extension only?
68
69**For DFlow spot trades:**
70
71- Imperative or declarative? If unsure, suggest starting with imperative.
72- Dev or production endpoints? If production, remind them to apply for an API key at pond.dflow.net/build/api-key.
73- Platform fees? If yes, what bps and what fee account?
74- Client environment? (web, mobile, backend, CLI)
75
76**For DFlow prediction markets:**
77
78- Settlement mint? (USDC or CASH — these are the only two)
79- Dev or production endpoints? If production, remind them to apply for an API key at pond.dflow.net/build/api-key.
80- Platform fees? If yes, use `platformFeeScale` for dynamic fees.
81- Client environment? (web, mobile, backend, CLI)
82
83### Step 4: Implement
84
85Follow the patterns in the reference files. Key rules by domain:
86
87**Phantom Connect:**
88
89- All SDK details (provider setup, hooks, components, auth providers) are in the SDK reference files. Read them before writing Phantom integration code.
90
91**DFlow Trading:**
92
93- Dev endpoints (`dev-quote-api.dflow.net`, `dev-prediction-markets-api.dflow.net`, `wss://dev-prediction-markets-api.dflow.net/api/v1/ws`) work without an API key but are rate-limited. Production requires a key from pond.dflow.net/build/api-key.
94- Prediction market trades require Proof KYC before buying or selling outcome tokens. Browsing and discovery do not require KYC.
95- Prediction markets also require geoblocking for restricted jurisdictions.
96
97### Step 5: Handle Errors
98
99Each reference file contains domain-specific error handling. Key cross-cutting concerns:
100
101- User rejects a transaction or signature request
102- Wallet not connected when a signed action is attempted
103- DFlow API returns 429 (rate limited) — retry with backoff or get a production API key
104- `route_not_found` from DFlow — check amount units (must be atomic), check liquidity, check mint addresses
105
106## Examples
107
108### Example 1: React wallet connection
109
110User says: "Add Phantom wallet login to my Next.js app"
111
112Actions:
113
1141. Read `references/react-sdk.md`
1152. Install `@phantom/react-sdk`
1163. Wrap app in PhantomProvider with desired auth providers and appId
1174. Use `useModal` hook for a connect button
1185. Use `useAccounts` to display the connected wallet address
119
120Result: Working wallet connection with social login and extension support
121
122### Example 2: Token-gated page
123
124User says: "Build a page that only BONK holders can see"
125
126Actions:
127
1281. Read `references/react-sdk.md` and `references/token-gating.md`
1292. Set up wallet connection
1303. Query the BONK token balance for the connected wallet
1314. Conditionally render content based on balance threshold
1325. For production: add server-side signature verification
133
134Result: Page that checks wallet token balance and gates content
135
136### Example 3: DFlow token swap
137
138User says: "Add a swap feature using DFlow"
139
140Actions:
141
1421. Ask: imperative or declarative? Platform fees? Client environment?
1432. Read `references/dflow-crypto-trading.md`
1443. If unsure on trade type, suggest imperative `/order` flow (simpler, synchronous)
1454. Connect wallet with Phantom, sign and submit transaction to Solana RPC
146
147Result: Working swap UI with DFlow routing
148
149### Example 4: Prediction market trade
150
151User says: "Let users buy YES/NO positions on prediction markets"
152
153Actions:
154
1551. Ask: settlement mint (USDC or CASH)? Platform fees? Client environment?
1562. Read `references/dflow-prediction-markets.md` and `references/dflow-proof.md`
1573. Build market discovery UI from Metadata API
1584. Gate trades behind Proof KYC verification
1595. Use /order endpoint to trade settlement mint into outcome tokens
160
161Result: Prediction market UI with KYC-gated trading
162
163### Example 5: Swap UI with wallet connection
164
165User says: "Build a full swap page with wallet connect and DFlow"
166
167Actions:
168
1691. Ask: which platform? Imperative or declarative swap? Platform fees?
1702. Read the relevant SDK reference AND `references/dflow-crypto-trading.md`
1713. Set up wallet connection with Phantom
1724. Build swap form, proxy `/order` calls through backend
1735. Sign transaction with connected wallet, submit to RPC
174
175Result: End-to-end swap page combining Phantom wallet and DFlow trading
176
177## Resources
178
179- Phantom Portal: phantom.com/portal
180- Phantom Docs: docs.phantom.com
181- SDK Examples: github.com/phantom/wallet-sdk/tree/main/examples
182- Phantom MCP Server: docs.phantom.com/resources/mcp-server
183- DFlow MCP Server: pond.dflow.net/mcp
184- DFlow MCP Docs: pond.dflow.net/build/mcp
185- DFlow Docs: pond.dflow.net/introduction
186- DFlow Cookbook: github.com/DFlowProtocol/cookbook