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
SVM Express Relay searchers fulfill opportunities representing limit orders on the [Limo](https://solscan.io/account/LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF) program.
6
6
7
+
Bids are represented via [SVM transactions](https://solana.com/docs/core/transactions) that include instructions for submitting the bid.
8
+
7
9
<Steps>
8
10
9
-
### Subscribe to New Opportunities
11
+
### Subscribe to SVM chain
10
12
11
-
Express Relay provides searchers with [Typescript](https://github.com/pyth-network/per/tree/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/js) and [Python](https://github.com/pyth-network/per/tree/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/python) SDKs to interact with Express Relay.
13
+
Searchers can use [Typescript](https://github.com/pyth-network/per/tree/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/js)
14
+
and [Python](https://github.com/pyth-network/per/tree/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/python) SDKs to interact with auction server.
12
15
Searchers can also directly fetch available opportunities via HTTP or subscribe to them via WebSocket.
Opportunities are short-lived and could be executed in a matter of seconds. So, the above endpoint could return an empty response.
81
-
82
103
</Tabs.Tab>
83
104
<Tabs.Tab>
84
105
Searchers can connect to the server via WebSocket to reduce latency and subscribe to various events. The WebSocket endpoint lives at `/v1/ws`(e.g `wss://pyth-express-relay-mainnet.asymmetric.re/v1/ws`).
@@ -94,20 +115,53 @@ Here is a sample JSON payload to subscribe to opportunities:
94
115
}
95
116
```
96
117
97
-
Consult [`Websocket API reference`](./websocket-api-reference.mdx) for a complete list of methods and parameters.
118
+
Consult [`WebSocket API reference`](./websocket-api-reference.mdx) for a complete list of methods and parameters.
98
119
99
120
</Tabs.Tab>
100
121
</Tabs>
101
122
102
123
The server responds with opportunities in the following format:
103
124
104
-
```bash copy
125
+
```json copy
105
126
{
106
-
"order": "UxMUbQAsjrfQUp5stVwMJ6Mucq7VWTvt4ICe69BJ8lVXqwM+0sysV8OqZTdM0W4p...", // The Limo order to be executed, encoded in base64
107
-
"order_address": "DUcTi3rDyS5QEmZ4BNRBejtArmDCWaPYGfN44vBJXKL5", // Address of the order account
108
-
"program": "limo", // Identifier of the program that the order exists in
109
-
"chain_id": "development-solana",
110
-
"version": "v1" // Opportunity format version
127
+
// The Limo order to be executed, encoded in base64
// Creation time of the opportunity (in microseconds since the Unix epoch)
138
+
"creation_time": 1733503592579589,
139
+
"slot": 305802439
140
+
}
141
+
```
142
+
143
+
The `order` field includes the [Limo](https://solscan.io/account/LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF) program
144
+
order data that can be decoded using the SDKs provided or the program anchor idl. It includes all the necessary information
145
+
to fill the limit order: - Maker address - Input token and amount (what the maker is selling) - Output token and amount (what the maker is buying in exchange for the input token)
146
+
147
+
<Callouttype="info">
148
+
Limo limit orders can also be filled partially in a linear fashion. For
149
+
example, if the order is to buy 10 SOL for \$2000, you can provide 5 SOL and
150
+
get back \$1000.
151
+
</Callout>
152
+
153
+
The auction server also broadcast chain specific information that are necessary for building the transaction:
154
+
155
+
```json copy
156
+
{
157
+
"type": "svm_chain_update",
158
+
"update": {
159
+
"chain_id": "development-solana",
160
+
// Recent blockhash that you can use when constructing the transaction
Thisinstructioncanbecreatedviathe SDKs. - Thedeadlinespecifiedinthe`SubmitBid`instructionshouldbeatleast 5 secondsinthe future. - Itshouldcontainaninstructiontosetthe [transactionpriorityfee](https://solana.com/developers/guides/advanced/how-to-use-priority-fees#what-are-priority-fees). The priority fee should be at least as large the amount
Copy file name to clipboardExpand all lines: pages/express-relay/websocket-api-reference.mdx
+46-13Lines changed: 46 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,43 +37,76 @@ In case of error, the `status` field will be `error`, and the error message will
37
37
}
38
38
```
39
39
40
-
## Subscribing to opportunities
40
+
## Subscribing to chains
41
41
42
-
To subscribe to opportunities, you can send a request using the `chain_ids` parameter, which specifies the chains as an array.
42
+
To subscribe to opportunities and chain updates, you can send a request using the `chain_ids` parameter, which specifies the chains as an array.
43
43
44
44
```json
45
45
{
46
46
"id": "1",
47
47
"method": "subscribe",
48
48
"params": {
49
-
"chain_ids": ["op_sepolia"]
49
+
"chain_ids": ["solana"]
50
50
}
51
51
}
52
52
```
53
53
54
-
After a successful subscription, you will receive new opportunities for the selected chains via the WebSocket in the following format:
54
+
To unsubscribe from a list of chains, you can send the following message:
55
+
56
+
```json copy
57
+
{
58
+
"id": "1",
59
+
"method": "unsubscribe",
60
+
"params": {
61
+
"chain_ids": ["solana"]
62
+
}
63
+
}
64
+
```
65
+
66
+
After a successful subscription, you will receive updates for the selected chains via the WebSocket in the following format:
67
+
68
+
<Tabsitems={['EVM', 'SVM']}>
69
+
70
+
<Tabs.Tab>
55
71
56
72
```json
57
73
{
58
-
"type": "new_opportunity",
59
-
"opportunity": {...}
74
+
"type": "new_opportunity",
75
+
"opportunity": {...}
60
76
}
61
77
```
62
78
63
-
The schema for the opportunity is similar to what’s returned in the [HTTP requests](https://pyth-express-relay-mainnet.asymmetric.re/docs#tag/opportunity/operation/get_opportunities)
79
+
</Tabs.Tab>
80
+
<Tabs.Tab>
64
81
65
-
To unsubscribe from a list of chains, you can send the following message:
82
+
```json
83
+
{
84
+
"type": "new_opportunity",
85
+
"opportunity": {...}
86
+
}
87
+
```
66
88
67
-
```json copy
89
+
You will receive svm specific updates in the following format:
90
+
91
+
```json
68
92
{
69
-
"id": "1",
70
-
"method": "unsubscribe",
71
-
"params": {
72
-
"chain_ids": ["op_sepolia"]
93
+
"type": "svm_chain_update",
94
+
"update": {
95
+
"chain_id": "development-solana",
96
+
// Recent blockhash that you can use when constructing the transaction
// Latest prioritization fee that is necessary to include in the transaction
99
+
"latest_prioritization_fee": 319592
73
100
}
74
101
}
75
102
```
76
103
104
+
</Tabs.Tab>
105
+
106
+
</Tabs>
107
+
108
+
The schema for the opportunity is similar to what’s returned in the [HTTP requests](https://pyth-express-relay-mainnet.asymmetric.re/docs#tag/opportunity/operation/get_opportunities)
109
+
77
110
## Submitting bids
78
111
79
112
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.
0 commit comments