$npx -y skills add agiprolabs/claude-trading-skills --skill raptor-dexSelf-hosted Solana DEX aggregator by SolanaTracker — multi-hop routing across 25+ DEXes, WebSocket streaming, Yellowstone Jet TPU submission, no rate limits
| 1 | # Raptor — Self-Hosted Solana DEX Aggregator |
| 2 | |
| 3 | Raptor is a self-hosted Rust binary that aggregates swap quotes across 25+ Solana DEXes. Unlike Jupiter, Raptor runs on your own infrastructure with **no rate limits**, **no API key**, and **no dependency on external API availability**. Free during public beta. |
| 4 | |
| 5 | - **Program ID (Mainnet)**: `RaptorD5ojtsqDDtJeRsunPLg6GvLYNnwKJWxYE4m87` |
| 6 | - **GitHub**: [solanatracker/raptor-binary](https://github.com/solanatracker/raptor-binary) |
| 7 | - **Docs**: [docs.solanatracker.io/raptor/overview](https://docs.solanatracker.io/raptor/overview) |
| 8 | |
| 9 | ## Quick Start |
| 10 | |
| 11 | ```bash |
| 12 | # Clone the binary repo (includes required signature file) |
| 13 | git clone https://github.com/solanatracker/raptor-binary |
| 14 | cd raptor-binary |
| 15 | |
| 16 | # Run with required environment variables |
| 17 | export RPC_URL="https://your-solana-rpc.com" |
| 18 | export YELLOWSTONE_ENDPOINT="https://your-yellowstone-grpc.com" |
| 19 | export YELLOWSTONE_TOKEN="your-token" # if required by provider |
| 20 | ./raptor |
| 21 | # Listens on 0.0.0.0:8080 by default |
| 22 | ``` |
| 23 | |
| 24 | **Requirements**: Solana RPC endpoint + Yellowstone gRPC endpoint (for pool indexing). Raptor uses very few RPC calls during normal operation since pool state is streamed via Yellowstone. |
| 25 | |
| 26 | **Signature file**: The `signature` file must be in the same directory as the Raptor binary. It authenticates your instance and is included in the repo clone. If you move the binary, copy the signature file with it. |
| 27 | |
| 28 | ## Execution Flow |
| 29 | |
| 30 | ``` |
| 31 | 1. GET /quote → Best route across 25+ DEXes |
| 32 | 2. POST /swap → Unsigned versioned transaction |
| 33 | 3. Sign locally → Your private key never leaves your machine |
| 34 | 4. POST /send-transaction → Submit via Yellowstone Jet TPU |
| 35 | 5. GET /transaction/{sig} → Confirm status (pending/confirmed/failed/expired) |
| 36 | ``` |
| 37 | |
| 38 | ## API Endpoints |
| 39 | |
| 40 | | Method | Endpoint | Description | |
| 41 | |--------|----------|-------------| |
| 42 | | `GET` | `/quote` | Get swap quote with multi-hop routing | |
| 43 | | `POST` | `/swap` | Build swap transaction from quote | |
| 44 | | `POST` | `/swap-instructions` | Get swap instructions only (no tx wrapper) | |
| 45 | | `POST` | `/quote-and-swap` | Quote + transaction in one request | |
| 46 | | `POST` | `/send-transaction` | Submit via Yellowstone Jet TPU with auto-retry | |
| 47 | | `GET` | `/transaction/:signature` | Track transaction status and parsed events | |
| 48 | | `GET` | `/health` | Health check (pools, cache, Yellowstone connection) | |
| 49 | |
| 50 | ## Get a Quote |
| 51 | |
| 52 | ```python |
| 53 | import httpx |
| 54 | |
| 55 | RAPTOR = "http://localhost:8080" |
| 56 | |
| 57 | resp = httpx.get(f"{RAPTOR}/quote", params={ |
| 58 | "inputMint": "So11111111111111111111111111111111111111112", # SOL |
| 59 | "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", # USDC |
| 60 | "amount": 1_000_000_000, # 1 SOL in lamports |
| 61 | "slippageBps": 50, |
| 62 | }) |
| 63 | quote = resp.json() |
| 64 | print(f"Output: {quote['amountOut']} lamports") |
| 65 | print(f"Price impact: {quote['priceImpact']}%") |
| 66 | print(f"Route: {len(quote['routePlan'])} hops") |
| 67 | ``` |
| 68 | |
| 69 | ### Quote Parameters |
| 70 | |
| 71 | | Parameter | Type | Required | Description | |
| 72 | |-----------|------|----------|-------------| |
| 73 | | `inputMint` | string | Yes | Input token mint address | |
| 74 | | `outputMint` | string | Yes | Output token mint address | |
| 75 | | `amount` | integer | Yes | Amount in smallest unit (lamports) | |
| 76 | | `slippageBps` | string | No | Basis points or `"dynamic"` (default: 50) | |
| 77 | | `dexes` | string | No | Comma-separated DEX filter | |
| 78 | | `excludeDexes` | string | No | DEXes to exclude | |
| 79 | | `maxHops` | integer | No | 1-4 hops (default: 4) | |
| 80 | | `directRouteOnly` | boolean | No | Only single-hop routes | |
| 81 | | `pools` | string | No | Comma-separated pool address filter | |
| 82 | | `feeBps` | integer | No | Platform fee 0-1000 bps | |
| 83 | | `feeAccount` | string | No | Fee recipient wallet | |
| 84 | |
| 85 | ## Build and Sign a Swap |
| 86 | |
| 87 | ```python |
| 88 | import base64 |
| 89 | import os |
| 90 | |
| 91 | # Step 2: Build transaction from quote |
| 92 | resp = httpx.post(f"{RAPTOR}/swap", json={ |
| 93 | "quoteResponse": quote, |
| 94 | "userPublicKey": "YOUR_WALLET_PUBKEY", |
| 95 | "wrapUnwrapSol": True, |
| 96 | "txVersion": "v0", |
| 97 | "priorityFee": "auto", # min|low|auto|medium|high|veryHigh|turbo|unsafeMax |
| 98 | "maxPriorityFee": 100_000, # cap in lamports |
| 99 | }) |
| 100 | swap = resp.json() |
| 101 | # swap["swapTransaction"] is base64-encoded unsigned transaction |
| 102 | |
| 103 | # Step 3: Sign locally (private key never sent to Raptor) |
| 104 | from solders.transaction import VersionedTransaction |
| 105 | from solders.keypair import Keypair |
| 106 | |
| 107 | tx_bytes = base64.b64decode(swap["swapTransaction"]) |
| 108 | tx = VersionedTransaction.from_bytes(tx_bytes) |
| 109 | keypair = Keypair.from_base58_string(os.getenv("PRIVATE_KEY")) |
| 110 | signed_tx = VersionedTransaction(tx.message, [keypair]) |
| 111 | signed_b64 = base64.b64encode(bytes(signed_tx)).decode() |
| 112 | |
| 113 | # Step 4: Submit via Yellowstone Jet TPU |
| 114 | resp = httpx.post(f"{RAPTOR}/send-transaction", json={ |
| 115 | "transaction": signed_b64, |
| 116 | }) |
| 117 | result = resp.json() |
| 118 | print(f"Signature: {result['signature']}") |
| 119 | |
| 120 | # Step 5: Track status |
| 121 | resp = httpx.get(f"{RAPTOR}/ |