Skip to content

Commit

Permalink
Add active quoting websocket docs (#3396)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse authored Nov 16, 2024
1 parent a7ff26a commit 3e8a2f3
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/bridge/docs/04-Routers/RFQ/API/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,54 @@ Active Quoting is more complicated than passive and requires listening for & res

- [`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,
}
```

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,
}
```

Subscribe / Unsubscribe content should be an array of chain ids.


## API Version Changes
Expand Down

0 comments on commit 3e8a2f3

Please sign in to comment.