Documentation Index
Fetch the complete documentation index at: https://pond.dflow.net/llms.txt
Use this file to discover all available pages before exploring further.
During development, you can use the developer endpoints without
an API key. For production use, you’ll need an API key to avoid
rate limits.
Priority fees only affect when a trade executes. They do not change routing,
slippage checks, or trade semantics (what priority fees do not affect).
How DFlow handles priority fees details the two modes.
Set up
Imports, env config, and the constants used across every step.Imports, env, and constants
import "dotenv/config";
import { Keypair } from "@solana/web3.js";
import bs58 from "bs58";
const DFLOW_TRADE_API_URL = process.env.DFLOW_TRADE_API_URL ?? "https://dev-quote-api.dflow.net";
const DFLOW_API_KEY = process.env.DFLOW_API_KEY; // optional; not needed for dev endpoints
const DFLOW_SETTLEMENT_MINT = process.env.DFLOW_SETTLEMENT_MINT ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; // USDC
const SOL_MINT = "So11111111111111111111111111111111111111112";
const amount = 1_000_000; // 0.001 SOL
const keypair = Keypair.fromSecretKey(
bs58.decode(process.env.SOLANA_PRIVATE_KEY ?? "")
);
const headers: HeadersInit = {};
if (DFLOW_API_KEY) headers["x-api-key"] = DFLOW_API_KEY;
Choose your priority fee mode
Apply priority fees to your request
Imperative (Order)
Declarative (Intent)
Set prioritizationFeeLamports on the /order request as either a lamport
value or one of auto, medium, high, veryHigh, disabled.Max Priority Fee (auto/level)
const maxParams = new URLSearchParams();
maxParams.append("inputMint", SOL_MINT);
maxParams.append("outputMint", DFLOW_SETTLEMENT_MINT);
maxParams.append("amount", amount.toString());
maxParams.append("userPublicKey", keypair.publicKey.toBase58());
maxParams.append("slippageBps", "50");
// Adaptive fee chosen by the server.
maxParams.append("prioritizationFeeLamports", "high");
// Or use automatic selection:
// maxParams.append("prioritizationFeeLamports", "auto");
const maxOrderResponse = await fetch(
`${DFLOW_TRADE_API_URL}/order?${maxParams.toString()}`,
{ headers }
).then((x) => x.json());
Exact Priority Fee (lamports)
const exactParams = new URLSearchParams();
exactParams.append("inputMint", SOL_MINT);
exactParams.append("outputMint", DFLOW_SETTLEMENT_MINT);
exactParams.append("amount", amount.toString());
exactParams.append("userPublicKey", keypair.publicKey.toBase58());
exactParams.append("slippageBps", "50");
// Fixed priority fee in lamports.
exactParams.append("prioritizationFeeLamports", "20000");
const exactOrderResponse = await fetch(
`${DFLOW_TRADE_API_URL}/order?${exactParams.toString()}`,
{ headers }
).then((x) => x.json());
For intents, set feeBudget on the /intent request to your desired
priority fee plus the 10,000 lamport base processing fee.Exact Priority Fee (feeBudget)
const desiredPriorityFeeLamports = 20_000;
const baseProcessingFeeLamports = 10_000;
const feeBudget = desiredPriorityFeeLamports + baseProcessingFeeLamports;
const intentParams = new URLSearchParams();
intentParams.append("inputMint", SOL_MINT);
intentParams.append("outputMint", DFLOW_SETTLEMENT_MINT);
intentParams.append("amount", amount.toString());
intentParams.append("userPublicKey", keypair.publicKey.toBase58());
intentParams.append("slippageBps", "50");
intentParams.append("feeBudget", feeBudget.toString());
const intentResponse = await fetch(
`${DFLOW_TRADE_API_URL}/intent?${intentParams.toString()}`,
{ headers }
).then((x) => x.json());
Priority Fees
How priority fees and the fee budget work, and when to use each mode.
Spot Quickstart
Execute your first spot swap end-to-end.
Add Platform Fees
Monetize trades with builder fees.
Authenticate Requests
Authenticate requests for production rate limits.
API Routes