You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/express-relay/errors.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Error Codes
2
2
3
-
The following table lists the error codes and their explanations for ExpressRelay and OpportunityAdapter contracts.
3
+
The following table lists the error codes and their explanations for [`ExpressRelay`](https://github.com/pyth-network/per/blob/main/contracts/src/express-relay/ExpressRelay.sol) and [`OpportunityAdapter`](https://github.com/pyth-network/per/blob/main/contracts/src/opportunity-adapter/OpportunityAdapter.sol) contracts.
4
4
They can be used to identify the cause of a failed transaction or bid.
Copy file name to clipboardExpand all lines: pages/express-relay/websocket-api-reference.mdx
+42-24Lines changed: 42 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,17 @@
1
-
# Websocket API Reference
1
+
import { Tabs } from"nextra/components";
2
2
3
-
You can connect to the server via websocket in order to reduce latency and subscribe to various events. The websocket endpoint relies at `/v1/ws`(e.g `wss://pyth-express-relay-mainnet.asymmetric.re/v1/ws`)
3
+
# WebSocket API Reference
4
+
5
+
Searchers can connect to the server via WebSocket to reduce latency and subscribe to various events.
6
+
The WebSocket endpoint lives at `/v1/ws`(e.g `wss://pyth-express-relay-mainnet.asymmetric.re/v1/ws`).
4
7
5
8
## General format
6
9
7
-
Each request sent to the server via websocket should be in the following json format:
10
+
Each request sent to the server via WebSocket should be in the following JSON format:
8
11
9
-
```json
12
+
```json copy
10
13
{
11
-
"id": "...", // used for uniquely identifying the responses to requests
14
+
"id": "...", // used for uniquely identifying the response to this request
12
15
"method": "...", // name of the server method to invoke
13
16
"params": {...} // parameters necessary for the method
14
17
}
@@ -24,7 +27,7 @@ The server responds using the same `id` specified in the request:
24
27
}
25
28
```
26
29
27
-
In case of error, `status` field will be `error` and the error message will be available in the `result` field as a string:
30
+
In case of error, the `status` field will be `error`, and the error message will be available in the `result` field as a string:
28
31
29
32
```json
30
33
{
@@ -36,7 +39,7 @@ In case of error, `status` field will be `error` and the error message will be a
36
39
37
40
## Subscribing to opportunities
38
41
39
-
To subscribe to opportunities you can send a request with the `chain_ids` parameter which specifies the chains as an array.
42
+
To subscribe to opportunities, you can send a request using the `chain_ids` parameter, which specifies the chains as an array.
40
43
41
44
```json
42
45
{
@@ -48,7 +51,7 @@ To subscribe to opportunities you can send a request with the `chain_ids` parame
48
51
}
49
52
```
50
53
51
-
After a successful subscription you will receive the new opportunities for the selected chains via the websocket in the following format:
54
+
After a successful subscription, you will receive new opportunities for the selected chains via the WebSocket in the following format:
52
55
53
56
```json
54
57
{
@@ -57,11 +60,11 @@ After a successful subscription you will receive the new opportunities for the s
57
60
}
58
61
```
59
62
60
-
The schema for the opportunity is similar to what’s returned in the [http requests](https://pyth-express-relay-mainnet.asymmetric.re/docs/#/liquidation/get_opportunities)
63
+
The schema for the opportunity is similar to what’s returned in the [HTTP requests](https://pyth-express-relay-mainnet.asymmetric.re/redoc#tag/opportunity/operation/get_opportunities)
61
64
62
-
In order to unsubscribe from a list of chains you can send the following message:
65
+
To unsubscribe from a list of chains, you can send the following message:
63
66
64
-
```json
67
+
```json copy
65
68
{
66
69
"id": "1",
67
70
"method": "unsubscribe",
@@ -73,9 +76,10 @@ In order to unsubscribe from a list of chains you can send the following message
73
76
74
77
## Submitting bids
75
78
76
-
In addition to the http methods, you can submit your bids via websocket in order to avoid additional network round-trips and get notified about changes to your bid status. Here is an example json payload for submitting a new bid
79
+
In addition to the HTTP methods, you can submit your bids via WebSocket in order to avoid additional network round trips and get notified about changes to your bid status.
80
+
Here is an example JSON payload for submitting a new bid:
77
81
78
-
```json
82
+
```json copy
79
83
{
80
84
"id": "1",
81
85
"method": "post_bid",
@@ -85,30 +89,33 @@ In addition to the http methods, you can submit your bids via websocket in order
A successful response to bid submission has the following schema:
98
+
A successful response to a bid submission has the following schema:
95
99
96
100
```json
97
101
{
98
-
"id": "1", // websocket request id
102
+
"id": "1", // WebSocket request id
99
103
"status": "success",
100
104
"result": {
101
-
"id": "beedbeed-b346-4fa1-8fab-2541a9e1872d", //bid id
105
+
"id": "beedbeed-b346-4fa1-8fab-2541a9e1872d", //bid id
102
106
"status": "OK"
103
107
}
104
108
}
105
109
```
106
110
107
-
From this point you will receive notifications about the bid status updates in JSON format. We share four examples below, one for each of the status options (”pending”, “submitted”, “lost”, “won”):
111
+
After submitting your bid via WebSocket, you will receive notifications about the bid status updates in JSON format.
112
+
Refer to the four examples below, one for each of the status options (`pending`, `submitted`, `lost`, `won`):
0 commit comments