# SpanDEX ## Docs - [Advanced](/advanced): Deadlines, timeouts, retries, etc - [Configuration](/configuration): Use `ConfigParams` to initialize config via `createConfig` or the `SpandexProvider` component. - [Examples](/examples): If you build something cool with SpanDEX, let us know. - [Fees](/fees): How to configure fee structures in SpanDEX with various providers swap fees, surplus, etc. - [Getting Started](/getting-started): Depending on your project stack and state, there are multiple ways to get started with Spandex. - [New Projects](/getting-started): If you are creating a new application, or kicking the tires, you can use our CLI to scaffold a new project with Spandex pre-configured. This command will choose which template to use based on your answers. - [Existing Projects](/getting-started): For react applications, see the [React getting started guide](/react/getting-started.mdx). Otherwise, see the [Core getting started guide](/core/getting-started.mdx). - [Installation](/installation): `@spandex/core` provides all the functionality to interact with multiple aggregators, simulate quotes onchain, and execute swaps. It depends on `viem` for blockchain interactions. - [Why SpanDEX](/overview): Let's clarify some key concepts in DeFi: DEX aggregators and meta aggregators. - [Onchain Simulation](/simulation): While fetched quotes provide a good estimate of swap costs, simulating a swap can provide a more accurate picture of how the swap will perform when executed onchain. - [ConfigParams](/reference/ConfigParams) - [SwapParams](/reference/SwapParams) - [Getting Started - React](/react/getting-started): To get started we will create a shared meta aggregator instance with three providers, default settings, and support for base. Then, we will fetch the best quote for a swap and execute it. - [useQuote](/react/hooks/useQuote): Fetch quotes from all configured aggregators, simulate them, and select a winner using a strategy. - [useQuoteExecutor](/react/hooks/useQuoteExecutor): Given a set of quotes, provides functions and state to execute necessary approvals and best quote to satisfy the swap itent. - [useQuoteMetadata](/react/hooks/useQuoteMetadata) - [useQuotes](/react/hooks/useQuotes): Fetch quotes from all configured aggregators and simulate each quote. - [useRawQuotes](/react/hooks/useRawQuotes): Fetch quotes from all configured aggregators without simulation. - [0x](/providers/0x): - [Fabric](/providers/fabric): - [KyberSwap](/providers/kyberswap): - [Lifi](/providers/lifi) - [Odos](/providers/odos): - [Relay](/providers/relay): - [Getting Started - Core](/core/getting-started): To get started we will create a shared meta aggregator instance with three providers, default settings, and support for base. Then, we will fetch the best quote for a swap and execute it. - [createConfig](/core/functions/createConfig): Create a configuration object to customize providers and options for all aggregation functions. - [decodeQuoteStream](/core/functions/decodeQuoteStream): Decode a quote stream produced by `newQuoteStream` into an array of quote promises. - [executeQuote](/core/functions/executeQuote): Execute a simulated quote onchain using a wallet client. Handles approval requirements and supports EIP-5792 batch calls when available. - [getPricing](/core/functions/getPricing): Aggregate pricing metadata across quotes and compute average USD prices when multiple sources are present. - [getQuote](/core/functions/getQuote): Fetch quotes, simulate them, and return a single winning quote based on a selection strategy. - [getQuotes](/core/functions/getQuotes): Fetches quotes from all configured providers and simulates the quote transactions to validate the swap operation and the final token output amount. - [getRawQuotes](/core/functions/getRawQuotes): Fetches quotes from all configured providers. This function does not perform any onchain simulation or validation. It is useful for scenarios where you plan to handle validation separately. Always simulate! - [newQuoteStream](/core/functions/newQuoteStream): Create a `ReadableStream` that emits serialized quotes as each promise resolves. This is useful for server-to-client streaming. - [prepareQuotes](/core/functions/prepareQuotes): Prepare a list of swap quote promise chains for quote fetching and secondary actions such as simulation. This is useful when custom behavior is required, such as racing quotes+simulation for multiple providers. - [selectQuote](/core/functions/selectQuote): Pick the best simulated quote from a set of in-flight quote+simulation promises. This is useful when you want to stream quotes and simulations concurrently and only commit to the best result once enough data is available. - [simulateQuote](/core/functions/simulateQuote): Simulate a single quote onchain and decorate it with simulation results. - [simulateQuotes](/core/functions/simulateQuotes): Simulate a batch of quotes given shared swap parameters and a client. - [sortQuotesByPerformance](/core/functions/sortQuotesByPerformance): Sort successful simulated quotes by a selected performance metric. - [Move along... nothing to see here!](/blog)