Dflow phantom connect

From x402agent/solana-clawd · View interactive version

Dflow phantom connect is an AI agent skill from the GitHub repository x402agent/solana-clawd. 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,

How to use this skill

Skill file

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:

DFlow trading:

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):

Solana patterns (transactions, gating, minting, payments):

DFlow trading (swaps, prediction markets, KYC):

Step 3: Ask the Right Questions

Before implementing, ask questions based on the domain:

For Phantom Connect tasks:

For DFlow spot trades:

For DFlow prediction markets:

Step 4: Implement

Follow the patterns in the reference files. Key rules by domain:

Phantom Connect:

DFlow Trading:

Step 5: Handle Errors

Each reference file contains domain-specific error handling. Key cross-cutting concerns:

Examples

Example 1: React wallet connection

User says: "Add Phantom wallet login to my Next.js app"

Actions:

  1. Read references/react-sdk.md
  2. Install @phantom/react-sdk
  3. Wrap app in PhantomProvider with desired auth providers and appId
  4. Use useModal hook for a connect button
  5. 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:

  1. Read references/react-sdk.md and references/token-gating.md
  2. Set up wallet connection
  3. Query the BONK token balance for the connected wallet
  4. Conditionally render content based on balance threshold
  5. 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:

  1. Ask: imperative or declarative? Platform fees? Client environment?
  2. Read references/dflow-crypto-trading.md
  3. If unsure on trade type, suggest imperative /order flow (simpler, synchronous)
  4. 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:

  1. Ask: settlement mint (USDC or CASH)? Platform fees? Client environment?
  2. Read references/dflow-prediction-markets.md and references/dflow-proof.md
  3. Build market discovery UI from Metadata API
  4. Gate trades behind Proof KYC verification
  5. 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:

  1. Ask: which platform? Imperative or declarative swap? Platform fees?
  2. Read the relevant SDK reference AND references/dflow-crypto-trading.md
  3. Set up wallet connection with Phantom
  4. Build swap form, proxy /order calls through backend
  5. Sign transaction with connected wallet, submit to RPC

Result: End-to-end swap page combining Phantom wallet and DFlow trading

Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.