Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Free & Open Source Meta-Aggregator

For Developers, Traders, and AI Agents—
  • Expands tokens, pools, and chains beyond any single aggregator
  • Queries multiple DEX aggregators to find the best price
  • Provides redundancy when a provider fails
  • No vendor lock-in

Aggregators—
0x
LiFi
Fabric
Kyberswap
Relay
Odos
Velora
0x
LiFi
Fabric
Kyberswap
Relay
Odos
Velora
core
import { getQuote } from "@spandex/core";
import { config } from "./config.js";
 
const quote = await getQuote({
  config,
  swap: {
    chainId: 8453,
    inputToken: "0x4200000000000000000000000000000000000006", // WETH
    outputToken: "0xd9AAEC86B65D86f6A7B5B1b0c42FFA531710b6CA", // USDbC
    mode: "exactIn",
    inputAmount: 1_000_000_000_000_000_000n, // 1 WETH
    slippageBps: 50,
    swapperAccount: "0x1234567890abcdef1234567890abcdef12345678",
  },
  strategy: "bestPrice",
});
 
if (!quote) {
  throw new Error("No providers returned a successful quote");
}
 
console.log(quote.provider, quote.simulation.outputAmount);