Skip to content

Commit b6e1253

Browse files
feat: rfq integration doc (#641)
* feat: rfq integration doc * chore: fix navigation paths * chore: remove unused files * feat: add back stats page * chore: tidy utils * feat: upgrade navigation logic * feat: add rfq integration to home page * chore: update rfq integration doc * chore: add rfq comms notes
1 parent 08d7618 commit b6e1253

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+627
-3015
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_label: "DEX Integration"
2+
sidebar_label: "Decentalized Exchanges"
33
description: "Integrate your DEX into Jupiter."
44
title: "DEX Integration"
55
---
@@ -9,8 +9,6 @@ title: "DEX Integration"
99
<meta name="twitter:card" content="summary" />
1010
</head>
1111

12-
## Overview
13-
1412
Jupiter is one of the most widely integrated protocols, so a lot of work is involved in minimizing issues on new integrations and making each integration valuable to our users and partners.
1513

1614
Our top priority is securing the best prices and the best token selection for our users, so we will focus on DEXes that will bring the most benefits to them.

docs/600-routing/index.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
sidebar_label: "About Routing"
3+
description: "About Jupiter Routing"
4+
title: "About Routing"
5+
---
6+
7+
<head>
8+
<title>About Routing</title>
9+
<meta name="twitter:card" content="summary" />
10+
</head>
11+
12+
Jupiter products utilizes the Swap infrastructure which is built on top of a robust and complex routing system that aggregates liquidity from multiple sources such as decentralized exchanges (DEXes) and market makers.
13+
14+
:::note
15+
If you are an exchange or market maker and want to participate in Jupiter routing, please refer to our [DEX Integration](/docs/routing/dex-integration) and [RFQ Integration](/docs/routing/rfq-integration) guides.
16+
:::
17+
18+
## DEX Routing
19+
20+
Jupiter's DEX routing system integrates with most AMMs and decentralized exchanges on Solana, accessible through our Swap API. You can find a complete list of supported AMMs and DEXes via the [/swap/v1/program-id-to-label](https://lite-api.jup.ag/swap/v1/program-id-to-label) endpoint.
21+
22+
Our routing infrastructure consists of several key components:
23+
24+
- A routing engine that finds the optimal price across all integrated venues
25+
- A market indexer that automatically detects and integrates most new markets (with a 14-day grace period before the crawler takes over)
26+
- A market crawler that runs periodically to categorize markets based on their liquidity
27+
28+
## Jupiter Z (RFQ) Routing
29+
30+
Jupiter Z is our Request for Quote (RFQ) system, it is intent based where the user express their desired price (intents) and market makers provide quotes to fulfill those intents.
31+
32+
Our RFQ system consists of:
33+
34+
- An order engine for RFQ processing
35+
- To include RFQ into our routing, we utilize a quote proxy that compares quotes between market makers and DEX routing to ensure best quotes
36+
- RFQ is accessible via the Ultra API
37+
38+
For more information about Jupiter Z, please refer to our [RFQ Integration](/docs/routing/rfq-integration) guide.
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
sidebar_label: "Jupiter Z (RFQ)"
3+
description: "Integrate your DEX into Jupiter."
4+
title: "RFQ Integration"
5+
---
6+
7+
<head>
8+
<title>RFQ Integration</title>
9+
<meta name="twitter:card" content="summary" />
10+
</head>
11+
12+
This section will cover the integration of your RFQ service into Jupiter's routing system.
13+
14+
:::caution
15+
The integration requirements are subjected to change and please provide suggestions or feedbacks on ways to improve the integration process.
16+
:::
17+
18+
<img src="/dev/rfq-flow.png" alt="RFQ Flow" width="700" />
19+
20+
## Integration Prerequisites
21+
22+
- Host a service that adheres to our RFQ API schema
23+
- Provide a webhook for Jupiter to send quotes and swap transactions
24+
- Complete end-to-end integration tests
25+
- When ready, you will be onboarded to Edge before going live on production
26+
27+
:::note
28+
[Please reach out to us in Discord](https://discord.gg/jup)
29+
- If you are interested to participate in Jupiter Z
30+
- If you need any help or clarification regarding the integration.
31+
- To begin onboarding to Edge.
32+
:::
33+
34+
### Example Integration
35+
36+
To facilitate the integration, we provide an [integration SDK in this repository](https://github.com/jup-ag/rfq-webhook-toolkit).
37+
38+
- [**Sample server**](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/server-example/): Implements the webhook API in Rust.
39+
- [**API Schema**](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/openapi): OpenAPI schema for the RFQ API.
40+
- [**Integration tests**](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/tests/): Verify the implementation of the webhook.
41+
- [**Troubleshooting**](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/tests/README.md#troubleshooting): Common issues that arise during integration.
42+
43+
---
44+
45+
### RFQ API Schema
46+
47+
To facilitate the integration into Jupiter's RFQ module, you will need to provide a webhook for us to register the quotation and swap endpoints with the corresponding request and response format.
48+
49+
| Endpoint | Method | URL | Description |
50+
|----------|--------|-----|-------------|
51+
| Base URL | - | `https://your-api-endpoint.com/jupiter/rfq` | Example URL that we will register into our API |
52+
| Quote | POST | `https://your-api-endpoint.com/jupiter/rfq/quote` | Called to request quotes |
53+
| Swap | POST | `https://your-api-endpoint.com/jupiter/rfq/swap` | Called to execute swaps |
54+
| Tokens | GET | `https://your-api-endpoint.com/jupiter/rfq/tokens` | Called periodically to fetch supported tokens (see [below](#advertising-supported-tokens)) |
55+
56+
:::note API Key
57+
If you require an API key to access your endpoints, please provide it to us during the registration process. The API Key will be passed to the webhook as a header `X-API-KEY`.
58+
:::
59+
60+
---
61+
62+
### Response Codes
63+
64+
Market Makers should return appropriate HTTP status codes along with error messages.
65+
66+
| Status Code | Description |
67+
|--------------|-------------|
68+
| `200 OK` | The request was successful, and the webhook will return a quote |
69+
| `404 Not Found` | The webhook will not return a quote for this request (e.g. the pair or the size are not supported) |
70+
| `400 Bad Request` | The request sent to the webhook is malformed (e.g. missing an expected parameter) |
71+
| `401 Unauthorized` | Authorization failed. For example the `X-API-KEY` is missing or incorrect |
72+
| `50x Server Errors` | The webhook is offline or unable to respond. If the status persist, the webhook will be temporarily suspended and will not receive requests |
73+
74+
:::note Timeouts
75+
A webhook must adhere to the [fullfillment and response time requirements](#fulfillment-requirements). When sending the quote request, the RFQ system includes the following headers:
76+
77+
| Header | Description |
78+
|--------|-------------|
79+
| `x-request-start` | The millisecond timestamp indicating when the request was sent |
80+
| `x-request-timeout` | The millisecond timeout for the request (currently set to 250 ms) |
81+
:::
82+
83+
## Integration Notes
84+
85+
### Order Engine
86+
87+
The RFQ functionality depends on the mainnet deployment of the [Order Engine Program](https://solscan.io/account/61DFfeTKM7trxYcPQCM78bJ794ddZprZpAwAnLiwTpYH) for order fulfillment.
88+
89+
- **Source Code**: The program's source is located in the [programs/order-engine](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/programs/order-engine) directory.
90+
- **IDL**: The Interface Definition Language (IDL) file is available [here](https://github.com/jup-ag/rfq-webhook-toolkit/tree/main/idls).
91+
92+
---
93+
94+
### Non-standard payload
95+
The transaction data includes, beside the instruction data for the order-engine, 3 additional bytes that are appended to the instruction data. These bytes are not processed by the program and are only information and to be consumed by an off-chain consumer. The first 2 bytes contains the fee amount in basis points (u16) and the third byte (u8) is a bit mask where the least significant bit indicates if the swap is exact-in (0) or exact-out (1).
96+
97+
---
98+
99+
### Fulfillment Requirements
100+
101+
To ensure market makers stay competitive and responsive, we enforce a minimum benchmark for fulfillment and response times.
102+
103+
- **Fulfillment**: Market makers are expected to comply and fulfill **95%** of the quotes provided within a 1-hour window. If this is not met, the market maker will be turned off.
104+
- **Response Time**: A webhook must respond within **250 ms** of receiving a quote request. If it fails to do so, the RFQ system will proceed with the available quotes at the time.
105+
106+
:::caution
107+
To resume operations, we will need to manually re-enable your webhook, please reach out to us if this happens.
108+
:::
109+
110+
:::danger need clarification
111+
are we penalizing the market maker if they consistently take more than 250ms to respond?
112+
:::
113+
114+
---
115+
116+
### Expiry
117+
118+
We enforce a fixed expiry timing flow for all quotes and transactions. This simplifies the integration by removing the need for market makers to specify custom expiry times in quote requests, providing consistent behavior across all quotes and transactions, and establishing clear timeout boundaries at different stages of the flow.
119+
120+
**Breakdown of the expiry flow:**
121+
122+
- **Total of 50 seconds**: Transaction expiry time
123+
- **1st 25 seconds**: Reserved for the webhook to verify, sign, and send the transaction on-chain
124+
- **2nd 25 seconds**: Allocated for the user to accept the quote
125+
126+
:::note
127+
The frontend automatically re-quotes every 5 seconds.
128+
:::
129+
130+
:::caution
131+
These expiry thresholds may be adjusted based on performance and feedback.
132+
:::
133+
134+
---
135+
136+
### Fees
137+
138+
Jupiter RFQ allows MMs a way to provide liquidity, adjust their quotes without being subject to the volatility of on-chain gas prices or chain health. RFQ fills are also much less CU intensive (< 10x) compared to AMM swaps, and can save gas in the long run on fills. Today, RFQ, when operating in Ultra mode, charges a dynamic fee that is selected based on factors like tokens and size.
139+
140+
**Dynamic Fee**
141+
142+
The dynamic fee amount is forwarded to webhooks in the quote request parameters and it is contained in the message that both taker and maker sign ([see the payload section above](#non-standard-payload)). In manual mode, the fee is a flat 2pbs.
143+
144+
**Fee Calculation**
145+
146+
Webhooks do not need to account for fees when quoting, the fee is applied directly by the RFQ system during transaction building.
147+
148+
- For example, for a quote of 1 SOL to 1,000 USDC with a fee of 100 bps
149+
- Only 990 USDC will be transferred out of the market maker account
150+
- While 10 USDC will be collected as a fee
151+
152+
:::note
153+
The fee is not automatically transferred and will be accounted for asynchronously on a regular basis.
154+
155+
This is subject to change in the future.
156+
:::
157+
158+
---
159+
160+
## FAQ
161+
162+
**Does RFQ support native SOL?**
163+
164+
Yes, native SOL is fully supported in the order-engine program for both the taker (user) and the maker. However, for now, we assume the maker will use WSOL (Wrapped SOL).
165+
166+
**Do faster quotes receive priority?**
167+
168+
No, the RFQ system dispatches the quote request to all registered webhooks simultaneously. All quotes received within the quote timeout are compared to select the best one. The selection prioritizes the quote value first (In the unlikely scenario where two quotes have identical values, the quote from the webhook with the faster response time will be actually prioritized).
169+
170+
**Shall a webhook verify swap requests?**
171+
172+
Yes, the RFQ system will verify the swap requests before forwarding them to the webhooks. However, webhooks are encouraged to verify the swap requests as well to ensure the integrity of the system. The checks that the RFQ system performs can be found in the [validate_similar_fill_sanitized_message](https://github.com/jup-ag/rfq-webhook-toolkit/blob/de46a38c3cfbda730c026a9b4bea85591c83f9e5/order-engine-sdk/src/fill.rs#L151) function.
173+
174+
**Is there a penalty for not providing a quote (status code 404)?**
175+
176+
No, there is no penalty. It is up to the webhook to decide whether to respond with a quote (`200 OK`) or indicate that it cannot provide one (`404 Not Found`).
177+
178+
For example, suppose a webhook provides quotes for USDC/SOL only within a range of 100 to 1000 USDC. If it receives a quote request for 10 USDC → SOL, it will respond with `404 Not Found`, since the amount is outside its quoting range.
179+
180+
In another case, a webhook may only support one-way quotes (USDC → SOL) but not SOL → USDC. If it receives a request for SOL → USDC, it will also return `404 Not Found`.
181+
182+
**Is there a fee applied to stable-to-stable swaps?**
183+
184+
No. Stable to stable swaps are exempt from fees.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Refer to the [What's New?](#whats-new) section for the latest API updates and br
2222

2323
**For existing developers**: Please refer to the [What's New?](#whats-new) section for the latest API updates and breaking changes.
2424

25-
**For routing integrations**: Please refer to the [DEX Integration](/docs/dex-integration) guide to complete the prerequisites before we look into integrating.
25+
**For routing integrations**: Please refer to the [DEX Integration](/docs/routing/dex-integration) and [RFQ Integration](/docs/routing/rfq-integration) guides to complete the prerequisites before we look into integrating.
2626

2727
**Quick Links** to APIs and Tool Kits:
2828

guides/11-jupiter-lock/1-jupiter-lock.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ description: "Jupiter Lock is an open-sourced, audited, and free ecosystem tool
99
<meta name="twitter:card" content="summary" />
1010
</head>
1111

12-
import DownloadBox from '/src/components/DownloadBox';
13-
1412
Jupiter Lock (https://lock.jup.ag/) is an [open-sourced](https://github.com/jup-ag/jup-lock), audited and free way to lock and distribute tokens over-time. Lock will be free for all project teams to lock tokens, implement cliff, and vest non-circulating supply in a clear and transparent manner.
1513

1614
### Jupiter Lock Specifications
@@ -25,8 +23,6 @@ Mainnet Deployment: `LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn`
2523

2624
The **IDL** for the Jupiter Lock program can be found on [Solscan](https://solscan.io/account/LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn#anchorProgramIdl), or available here:
2725

28-
<DownloadBox fileName="locker.json" /> &nbsp;
29-
3026
:::info Jupiter Lock is in Beta
3127
Feel free to submit PRs, suggestions, or reach out to us! If you need help with Jupiter Lock or have any feedback on how to improve, let us know on Discord or [Telegram](https://t.me/xianxlb).
3228
:::

guides/12-general/7-media-kit.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,8 @@ description: "Get the official Jupiter media kit, including logo, brand material
99
<meta name="twitter:card" content="summary" />
1010
</head>
1111

12-
import DownloadBox from '/src/components/DownloadBox';
13-
1412
Please find official Jupiter information, imagery, infographics, and contacts below for your own use.
1513

1614
For additional info or media inquiries, please contact [email protected]
1715

1816
Or contact Jupiter through [Twitter](https://twitter.com/JupiterExchange) or [Discord](https://discord.gg/jup)
19-
20-
### Jupiter Logo
21-
22-
<DownloadBox fileName="jupiter-logo.zip" />
23-
24-
### Jupiter Integration
25-
26-
<DownloadBox fileName="powered-by-jupiter.zip" />
27-
28-
### Download Jupiter Brand Materials
29-
30-
<DownloadBox fileName="jupiter-brand-materials.zip" />
31-
32-
### Jupiter Token Logo
33-
34-
_(JUP Token, JLP Token, JupSOL Token Logos)_
35-
36-
<DownloadBox fileName="jupiter-token-logo.zip" />

redirects.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[
2+
{"to":"/docs/routing/dex-integration","from":"/docs/dex-integration"},
3+
24
{"to":"/docs/misc/integrator-guidelines","from":"/docs/misc/support-guidelines"},
35

46
{"to":"/docs/","from":"/docs/get-started"},

sidebars-docs.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,32 @@ const sidebars = {
5454
],
5555
},
5656
],
57+
routing: [
58+
{
59+
type: 'doc',
60+
id: 'routing/index',
61+
},
62+
{
63+
type: 'html',
64+
value: '<div class="sidebar-line-break"></div>',
65+
},
66+
{
67+
type: 'category',
68+
label: 'Routing Integrations',
69+
collapsible: false,
70+
collapsed: false,
71+
items: [
72+
{
73+
type: 'doc',
74+
id: 'routing/dex-integration',
75+
},
76+
{
77+
type: 'doc',
78+
id: 'routing/rfq-integration',
79+
},
80+
],
81+
},
82+
],
5783
misc: [
5884
{
5985
type: 'category',

src/components/DownloadBox/index.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)