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