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
Express Relay gives one place stop for on-chain opportunities. Searchers can access opportunities from various DeFi protocols via a simple and unified interface.
5
+
Express Relay allows searchers to integrate once and access all existing and future opportunities across integrated DeFi protocols.
6
+
Searchers **bid** on these opportunities exposed by Express Relay.
6
7
7
-
Searchers **bid** on opportunities exposed by the Express Relay server.
8
-
The server exposes different endpoints for interaction, which can be used directly via HTTP, WebSocket, or one of the SDKs for convenience.
8
+
Express Relay exposes different endpoints for interaction, which can be used directly via HTTP, WebSocket, or one of the SDKs for convenience.
9
9
10
-
Searchers can integrate with the Express Relay server in three steps:
10
+
Searchers can integrate with Express Relay in three steps:
11
11
12
12
1. Subscribe to new opportunities
13
13
2. Evaluate the opportunity and construct the bid
14
-
3. Submit the bid to the auction server
14
+
3. Submit the bid to Express Relay.
15
15
16
16
<Steps>
17
17
18
-
### Subscribing to new opportunities
18
+
### Subscribe to new opportunities
19
19
20
-
Express Relay provides searchers with `Typescript` and `Python` SDKs to interact with the server.
21
-
Searchers can also fetch available opportunities via HTTP or subscribe to them via WebSocket.
20
+
Express Relay provides searchers with `Typescript` and `Python` SDKs to interact with Express Relay.
21
+
Searchers can also directly fetch available opportunities via HTTP or subscribe to them via WebSocket.
Searchers can request opportunities through an HTTP GET call to the `/v1/opportunities` endpoint.
68
+
Searchers can request opportunities through an HTTP **GET** call to the [`/v1/opportunities`](https://pyth-express-relay-mainnet.asymmetric.re/redoc#tag/opportunity/operation/get_opportunities) endpoint.
Opportunities are short-lived and will be executed in a matter of seconds. So, the above endpoint can return an empty response.
78
-
79
-
You can fetch historical opportunities by setting the `mode` parameter to `historical`.
75
+
Opportunities are short-lived and could be executed in a matter of seconds. So, the above endpoint could return an empty response.
80
76
81
77
</Tabs.Tab>
82
78
<Tabs.Tab>
83
-
Searchers can connect to the server via WebSocket 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`).
79
+
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`).
84
80
Here is a sample JSON payload to subscribe to opportunities:
85
81
86
82
```bash copy
@@ -102,49 +98,50 @@ The server responds with opportunities in the following format:
102
98
103
99
```bash copy
104
100
{
105
-
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
106
-
"chain_id": "op_sepolia",
107
-
"target_contract": "0xcA11bde05977b3631167028862bE2a173976CA11", // Protocol contract address to callfor execution
108
-
"permission_key": "0xcafebabe", // Permission key required for the liquidation opportunity
109
-
"target_call_value": "1", // Value(in Wei) to send with to the Protocol contract.
110
-
"buy_tokens": [ // Tokens to buy
101
+
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
102
+
"chain_id": "op_sepolia",
103
+
"target_contract": "0xcA11bde05977b3631167028862bE2a173976CA11", // Protocol contract address to call
104
+
"permission_key": "0xcafebabe", // Unique identifier for the opportunity
105
+
"target_call_value": "1", // Value(in Wei) to send to the protocol contract.
106
+
"sell_tokens": [ // Tokens the protocol expects to receive
### Evaluate the opportunity and construct the bid
127
123
128
-
Searchers should construct a bit based on the fetched opportunity details like `buy_tokens` and `sell_tokens`.
129
-
The SDKs provide an easy way to construct a bid using the `OpportunityAdapter` contract.
124
+
Searchers should construct a bid based on the fetched opportunity.
125
+
The SDKs provide an easy way to construct a bid using the [`OpportunityAdapter`](./integrate-as-searcher/opportunity-adapter.mdx) contract.
130
126
The `OpportunityAdapter` contract handles asset transfers and ensures the opportunity is executed correctly.
131
127
132
-
You can learn more about the `OpportunityAdapter` contract and how to prepare your assets in the [Opportunity Adapter](./integrate-as-searcher/opportunity-adapter.mdx) section.
133
-
If you have already developed an in-house searcher contract, integrating using the Opportunity Adapter contract is unnecessary.
134
-
You can use our lower-level APIs, which allow higher flexibility for advanced users.
135
-
Please refer to the [custom contracts](./integrate-as-searcher/custom-contract.mdx) section for more details.
128
+
<Callouttype="warning"emoji="⚠️">
129
+
Before constructing the bid, make sure your wallet has the required assets and has made the necessary approvals.
130
+
Refer to the [Prepare assets for OpportunityAdapter](./integrate-as-searcher/opportunity-adapter.mdx) section for more details.
131
+
</Callout>
136
132
137
-
Here is an example of how to construct a bid using the SDKs:
133
+
134
+
Here is an example of how to construct a bid using `OpportunityAdapter` via the SDKs:
### Submit bids on opportunities to the auction server
175
171
176
-
Searchers can submit the constructed bids to the auction server via the SDKs, an HTTP POST request, or a WebSocket connection.
172
+
173
+
174
+
If you prefer to use your own custom contracts instead of the `OpportunityAdapter`, please refer to the [custom contracts](./integrate-as-searcher/custom-contract.mdx) section.
175
+
176
+
### Submit bids on opportunities to Express Relay
177
+
178
+
Searchers can submit the constructed bids to Express Relay via the SDKs, an HTTP POST request, or a WebSocket connection.
Searchers can submit bids through an HTTP POST call to the `/v1/bids` endpoint. This endpoint accepts a JSON payload containing the details of the bid.
208
+
Searchers can submit bids through an HTTP POST call to the [`/v1/bids`](https://pyth-express-relay-mainnet.asymmetric.re/redoc#tag/bid/operation/bid) endpoint. This endpoint accepts a JSON payload containing the details of the bid.
207
209
208
210
```bash copy
209
211
curl -X POST https://pyth-express-relay-mainnet.asymmetric.re/v1/bids \
0 commit comments