Dev Mode - Solana
Dev Mode lets you spin up a local Socket.IO server for manual trading while still reusing the full Leap trader engine — including pricing, position tracking, and analytics logic.
⚙️ Overview
When you enable Dev Mode, it runs a local Socket.IO server that listens on port 8080.
This server exposes only the /socket.io/ namespace — all other HTTP requests are rejected.
// Example connection:
const socket = io("http://localhost:8080", { path: "/socket.io/" });This setup ensures your manual trades go through the same internal logic (pricing, validation, and analytics) as live trades — just locally.
📡 Connecting with Socket.IO
Port:
8080Namespace:
/socket.io/Protocol: WebSocket (via Socket.IO client)
All communications must target the /socket.io/ namespace.
If you send HTTP requests elsewhere, the server rejects them automatically.
🧾 Request Payload Schema
All trade actions share the same OrderRequest schema.
Below is the complete list of available fields.
id
string
optional
Used to correlate requests and responses.
token
string
✅ required
Base58 token address.
amount
float
optional
Custom SOL amount for "buy".
sellPercentage
int
required for "sell"
Percentage (1–100) to sell.
buyMc
float
required for "add"
Market cap (USD) when seeding a manual position.
holdings
float
required for "add"
Number of tokens held for the added position.
buyPriorityFee, sellPriorityFee
float
optional
Override default priority fees.
buySlippage, sellSlippage
float
optional
Override slippage settings.
processor
string
optional
Choose routing processor: "jito", "blox", "temporal", "zeroslot", or "astralane".
processorFee
float
optional
Custom fee when a processor is set.
Server-side validation ensures required fields are present.
If validation fails, the server emits an "error" response with a descriptive message.
🚀 Supported Actions
1. "buy"
"buy"Places a market buy for the requested token. Optional fields let you override:
Buy amount
Priority fee
Slippage
Processor routing
Once executed, the trader posts a "confirmed" response with trade details.
2. "sell"
"sell"Sells all or part of your current position.
Requires
sellPercentage(e.g.25,50,100)The system automatically looks up your holdings and executes a proportional sell.
Emits a
DEV_MODEsignal into the normal exit flow.
3. "add"
"add"Seeds Dev Mode with a manual position you already hold. You must include:
tokenbuyMc(market cap at entry)holdings
The server reconstructs the position, calculates spent SOL, and begins PnL tracking.
You can later sell this token using "sell" through Dev Mode.
🔁 Response Flow
All responses are emitted on the "response" event.
Each includes:
type
"buy", "sell", "add", or "error"
id
The correlated request ID
amounts
Amounts traded
tx
Transaction signature (if applicable)
status
"received", "queued", "confirmed", or "failed"
message
Optional error or info text
Example Flow
You send a
"buy"request withid: "123".The server validates it → sends
"received".After execution, it emits a
"confirmed"response (including on-chain signature).Your client matches responses by
idto update the UI or CLI.
🧩 Example Usage
socket.emit("buy", {
id: "trade1",
token: "So11111111111111111111111111111111111111112",
amount: 0.5,
buyPriorityFee: 0.0005,
processor: "jito",
});
socket.on("response", (res) => {
console.log("Response:", res);
});✅ Summary
Local Testing
Trade manually without touching live funds
Full Logic Reuse
Uses same pricing, analytics, and validation as main trader
Real-Time Feedback
"response" events mirror production flow
Extensible
Supports all processors and fee overrides
Last updated