Quoting Orders
To avoid the need for solvers to respond to every individual quote request, the order server allows solvers to regularly push their inventory to the order server in the format of quote chunks
.
This approach significantly reduces the overhead for solvers and improves the efficiency of the quoting process.
Solvers can broadcast their available liquidity and pricing information in the following format:
// example of 2 quote chunks{ "chainId": 1, // Ethereum "asset": "0xA0b86991c...", // USDC on Ethereum, address(0) for native tokens "fromPrice": "1000000", // price of token in USDC when sold to the solver "toPrice": "1100000", // price of token in USDC when bought from the solver "fromCost": "1000", // cost of token in USDC when sold to the solver "toCost": "1000", // cost of token in USDC when bought from the solver "maxAmount": 1000000000, // max the solver will handle "minAmount": 1000000, // optional minimum amount "expiry": 1713296400 // quote expires at this timestamp}
{ "chainId": 8453, // Base "asset": "0xA0b86991c...", // USDC on Base, address(0) for native tokens "fromPrice": "9900000", // price of token in USDC when sold to the solver "toPrice": "1000000", // price of token in USDC when bought from the solver "fromCost": "1000", // cost of token in USDC when sold to the solver "toCost": "1000", // cost of token in USDC when bought from the solver "maxAmount": 1000000000, // max the solver will handle "minAmount": 1000000, // optional minimum amount "expiry": 1713296400 // quote expires at this timestamp}
Prices are specified in an abstract intermediary that has to be consistent between your quotes. We recommended using USDC. Everything is integer priced. Make sure that your decimals are correct. The final quote will be derived as:
It is important that solvers update their quotes periodically as market conditions change with correct expiry dates. If your quotes expire, the order server will stop using them to match user requests.
By broadcasting quotes in this manner, solvers can:
- Efficiently communicate their available liquidity across multiple chain and token pairs
- Set their own pricing and fee structure
- Define limits on transaction sizes they’re willing to process
- Update their quotes as market conditions change
- The order server then uses these broadcast quotes to match incoming user requests without needing to query solvers in real-time for every request, resulting in faster quote responses for users and reduced operational overhead for solvers.
Here’s a simple JavaScript example showing how to submit quotes to the Catalyst order server:
// Using fetch API (browser or Node.js with node-fetch)async function submitQuote(apiKey, quoteData) { const response = await fetch("order-server-uri/quotes/submit", { method: "POST", headers: { "Content-Type": "application/json", "x-api-key": apiKey, }, body: JSON.stringify(quoteData), });
if (!response.ok) { throw new Error( `Error submitting quote: ${response.status} ${response.statusText}` ); }
return await response.json();}
// Example usageconst apiKey = "your-api-key-here";const quote = { chainId: 1, // Ethereum asset: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum fromPrice: "1000000", // price of token in USDC when sold to the solver toPrice: "1100000", // price of token in USDC when bought from the solver fromCost: "1000", // cost of token in USDC when sold to the solver toCost: "1000", // cost of token in USDC when bought from the solver maxAmount: 1000000000, // max the solver will handle minAmount: 10000000, // optional minimum amount expiry: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now};
// Submit the quotesubmitQuote(apiKey, quote) .then((response) => console.log("Quote submitted successfully:", response)) .catch((error) => console.error("Failed to submit quote:", error));
Authentication
Section titled “Authentication”While authentication is not necessary to subscribe to the order server’s WebSocket events, it is required to use some order server’s API services. All solvers need to be authenticated with the Catalyst order server to be able to push their inventory to the order server. Without it, the order server won’t be able to offer your quotes to users. Authentication is handled via API tokens that provide secure access to the order server’s protected API services.
Obtaining API Access
Section titled “Obtaining API Access”To get your API token please reach out to the order server team.
Using Your API Token
Section titled “Using Your API Token”If you have an API token, it must be included in all requests to the order server for reputation purposes:
- For HTTP requests: Include the token in the request headers as
x-api-key: YOUR_API_TOKEN