dflow-spot-trading
БесплатноБез исполняемых скриптовНе проверенSwap any pair of Solana tokens via DFlow. Use when the user wants to trade, swap, or convert tokens on Solana, get a price quote, build a swap UI, tune…
от x402agent★ 26 звёзд на GitHubОб этом скилле
DFlow Spot Trading
Swap any pair of Solana tokens via DFlow. Imperative trades (the default) settle synchronously in one transaction; declarative trades are opt-in for users who explicitly want better execution.
Prerequisites
- DFlow docs MCP (
https://pond.dflow.net/mcp) — install per the repo README. This skill is the recipe; the MCP is the reference. Look up endpoint shapes, parameter details, error codes, and anything else field-level viasearch_d_flow/query_docs_filesystem_d_flow— don't guess. dflowCLI (optional, for command-line/agent use) — install per the repo README.
Choose your surface
- CLI — command line, scripts, local agents. Manages keys, signs, broadcasts.
- API — web/mobile apps, backends, automations with their own wallet/signer. Browser apps must proxy HTTP through their backend (the Trading API serves no CORS).
If unclear, ask once: "From the command line, or wired into an app?"
Workflows
Quote (read-only)
- CLI:
dflow quote <atomic-amount> <FROM> <TO> - API:
GET /orderdoubles as a quote — including without auserPublicKey, in which case it returns all price fields with no transaction attached. Use this for live-quote UIs before the user has connected a wallet. Don't reach for/quoteseparately; it's the older surface and the docs redirect back to/order.
Trade — imperative /order (the default)
Single round-trip: get a quote and a signed-ready VersionedTransaction together; sign, submit, confirm. Fully synchronous. Works with all SPL + Token-2022 mints.
CLI:
dflow trade <atomic-amount> <FROM> <TO>(add--confirmfor agents/scripts that need to block until confirmed).API:
GET /order?userPublicKey=&inputMint=&outputMint=&amount=, deserializetransaction(base64) →VersionedTransaction, sign + broadcast, confirm against the blockhash DFlow signed with. Two broadcast idioms — pick the one that matches your context:- Browser wallet-adapter app (the default for UIs).
const sig = await wallet.sendTransaction(tx, connection). The wallet signs and broadcasts through its own RPC — yourconnectiononly needs to serve reads (confirmTransaction). - Node script / server-side signing with a
Keypair. Two-step:tx.sign([keypair])→connection.sendRawTransaction(tx.serialize()). Your RPC is what broadcasts; a public endpoint will 403.
The full browser-adapter happy path, end to end:
- Browser wallet-adapter app (the default for UIs).
const { transaction, lastValidBlockHeight } = await fetch("/api/order?...").then(r => r.json());
const tx = VersionedTransaction.deserialize(Buffer.from(transaction, "base64"));
const sig = await sendTransaction(tx, connection); // wallet's RPC
await connection.confirmTransaction( // app's RPC (reads only)
{ signature: sig, blockhash: tx.message.recentBlockhash, lastValidBlockHeight },
"confirmed",
);
Where each /order response field goes (don't re-derive these locally — DFlow owns the authoritative value):
transaction(base64) →VersionedTransaction.deserialize→wallet.sendTransaction(browser) orconnection.sendRawTransaction(Node).lastValidBlockHeight→connection.confirmTransaction, paired withtx.message.recentBlockhashfrom the deserialized tx. Never a freshgetLatestBlockhash(see Gotchas).inAmount/outAmount/otherAmountThreshold/priceImpactPct/slippageBps→ display.prioritizationFeeLamports/prioritizationType→ echo / logging. The server-resolved priority-fee choice after"auto"resolution.contextSlot→ logging / staleness checks.routePlan→ optional display / debugging.
Fields marked "Specified if and only if the request included the user's public key" in the OpenAPI (transaction, lastValidBlockHeight, computeUnitLimit, prioritizationFeeLamports, addressLookupTables) are absent on quote-only calls — check before using.
Full runnable example (server-side Keypair variant): /build/recipes/trading/imperative-trade (links to the DFlow Cookbook Repo). Field-level schema details via the docs MCP.
Trade — declarative /intent + /submit-intent (opt-in)
User signs an intent (asset pair, slippage, min-out); DFlow picks the route at execution time and fills via Jito bundles. Sells on: less slippage, better pricing, sandwich protection.
Hard restriction: /intent does not support Token-2022 mints. Verify both mints are SPL before suggesting; otherwise stay on /order.
Only suggest declarative when the user explicitly asks for sandwich protection or "best execution." Recipe details (intent shape, polling) via the docs MCP.
What to ASK the user (and what NOT to ask)
Trade shape — infer if unambiguous, confirm if not:
- **Input + output to
Установить dflow-spot-trading в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл dflow-spot-trading?
Swap any pair of Solana tokens via DFlow. Use when the user wants to trade, swap, or convert tokens on Solana, get a price quote, build a swap UI, tune priority fees so a swap lands under congestion, or build a gasless / sponsored swap where the app pays fees. Covers both the `dflow` CLI and the DFlow Trading API. Do NOT use for Kalshi prediction-market YES/NO trades or builder-side platform fees.
Как установить скилл dflow-spot-trading?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dflow-spot-trading запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic