-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: websocket documentation for active quoting #3396
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,54 @@ Please note that end-users and solvers will not need to run their own version of | |
|
||
- [`PUT /rfq`](./put-rfq-request.api.mdx) - Initiate an RFQ and receive the best available quote. | ||
|
||
## Websocket API for Quoters | ||
|
||
The websocket API allows quoters to interact with user quote requests once connected to the `GET /rfq_stream` endpoint. | ||
|
||
The websocket API exposes several operations for quoters: | ||
- `ping` - sends a heartbeat to the API server to keep the connection alive (must be sent at least once per minute) | ||
- `subscribe` - subscribes to quote requests for given chain(s) | ||
- `unsubscribe` - unsubscribes to quote requests for given chain(s) | ||
- `send_quote` - responds to a quote request | ||
|
||
The API server may respond with the following operations: | ||
- `pong` - acknowleges a `ping` message | ||
- `request_quote` - informs quoter of a new user quote request | ||
|
||
All websocket messages follow this format: | ||
``` | ||
{ | ||
op: string, | ||
content: json, | ||
success: bool, | ||
} | ||
``` | ||
Comment on lines
+77
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance message format specification. The message format needs:
- ```
+ ```json
{
- op: string,
- content: json,
- success: bool,
+ "op": "string", // Operation type (e.g., "ping", "subscribe")
+ "content": "json", // Operation-specific payload
+ "success": "bool" // Indicates if the operation was successful
}
|
||
|
||
Quote request content should have the following format: | ||
|
||
``` | ||
{ | ||
data: { | ||
origin_chain_id: number, | ||
dest_chain_id: number, | ||
origin_token_addr: string, | ||
dest_token_addr: string, | ||
origin_amount_exact: string, | ||
expiration_window: number // number of ms since created_at until request should expire | ||
}, | ||
} | ||
``` | ||
|
||
Quote response content should have the following format: | ||
|
||
``` | ||
{ | ||
request_id: string, | ||
dest_amount: string, | ||
} | ||
``` | ||
Comment on lines
+86
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add field validations and improve format specifications. Please enhance the content formats with:
- ```
+ ```json
{
"data": {
- origin_chain_id: number,
- dest_chain_id: number,
- origin_token_addr: string,
- dest_token_addr: string,
- origin_amount_exact: string,
- expiration_window: number
+ "origin_chain_id": "number", // Source chain ID (e.g., 1 for Ethereum)
+ "dest_chain_id": "number", // Destination chain ID
+ "origin_token_addr": "string", // Token address on source chain (0x...)
+ "dest_token_addr": "string", // Token address on destination chain
+ "origin_amount_exact": "string", // Amount in wei (must be > 0)
+ "expiration_window": "number" // Must be between 1000 and 300000 ms
},
}
🧰 Tools🪛 Markdownlint88-88: null (MD040, fenced-code-language) 103-103: null (MD040, fenced-code-language) |
||
|
||
Subscribe / Unsubscribe content should be an array of chain ids. | ||
|
||
|
||
**API Version Changes** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error responses and examples.
Please enhance this section by:
🧰 Tools
🪛 Markdownlint
74-74: Expected: 0; Actual: 2
Unordered list indentation
(MD007, ul-indent)
75-75: Expected: 0; Actual: 2
Unordered list indentation
(MD007, ul-indent)