Skip to content

Commit 4f2f9e4

Browse files
committed
WIP-searcher-guide-refactor
1 parent 56d8802 commit 4f2f9e4

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

pages/express-relay/integrate-as-searcher.mdx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ The server exposes different endpoints for interaction, which can be used direct
1010
Searchers can integrate with the Express Relay server in three steps:
1111

1212
1. Subscribe to new opportunities
13-
2. Evaluating the opportunity and constructing the bid
14-
3. Submitting the bid to the auction server
13+
2. Evaluate the opportunity and construct the bid
14+
3. Submit the bid to the auction server
1515

1616
<Steps>
1717

18-
### Subscribe to new opportunities
18+
### Subscribing to new opportunities
1919

20-
Searchers can fetch available opportunities via HTTP or subscribe to them via WebSocket.
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.
2122

2223
<Tabs items={['Typescript', 'Python', 'HTTP', 'Websocket']}>
2324

@@ -43,7 +44,7 @@ await client.subscribeChains(["op_sepolia"]);
4344
<Tabs.Tab>
4445
Our Python SDK provides a convenient way to subscribe to opportunities:
4546

46-
```python
47+
```python copy
4748
from express_relay.client import (
4849
ExpressRelayClient,
4950
)
@@ -73,16 +74,16 @@ curl -X 'GET' \
7374
'https://pyth-express-relay-mainnet.asymmetric.re/v1/opportunities?chain_id=op_sepolia&mode=live'
7475
```
7576

76-
Opportunities are short-lived and will be executed in a matter of seconds. So it is possible for this endpoint to return an empty response.
77+
Opportunities are short-lived and will be executed in a matter of seconds. So, the above endpoint can return an empty response.
7778

7879
You can fetch historical opportunities by setting the `mode` parameter to `historical`.
7980

8081
</Tabs.Tab>
8182
<Tabs.Tab>
8283
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`)
83-
Here is a sample json payload to subscribe to opportunities:
84+
Here is a sample JSON payload to subscribe to opportunities:
8485

85-
```json copy
86+
```bash copy
8687
{
8788
"id": "1",
8889
"method": "subscribe",
@@ -99,13 +100,13 @@ Consult [`Websocket API reference`](./websocket-api-reference.mdx) for a complet
99100

100101
The server responds with opportunities in the following format:
101102

102-
```json copy
103+
```bash copy
103104
{
104-
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
105+
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
105106
"chain_id": "op_sepolia",
106-
"target_contract": "0xcA11bde05977b3631167028862bE2a173976CA11", // Protocol contract address to call for execution
107-
"permission_key": "0xcafebabe", // Permission key required for the liquidation opportunity
108-
"target_call_value": "1", // Value(in Wei) to send with to the Protocol contract.
107+
"target_contract": "0xcA11bde05977b3631167028862bE2a173976CA11", // Protocol contract address to call for 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.
109110
"buy_tokens": [
110111
// Tokens to buy
111112
{
@@ -120,14 +121,15 @@ The server responds with opportunities in the following format:
120121
"token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
121122
}
122123
],
123-
"version": "v1" // Opportunity format version
124+
"version": "v1" // Opportunity format version
124125
}
125126
```
126127

127-
### Evaluating the opportunity and constructing the bid
128+
### Evaluate the opportunity and construct the bid
128129

129-
Based on the opportunity details, mainly the sell tokens and buy tokens, searchers can evaluate the opportunity and construct a bid.
130-
The SDKs provide an easy way to construct a bid using the `OpportunityAdapter` contract. The `OpportunityAdapter` contract handles asset transfers and ensures the opportunity is executed correctly.
130+
Searchers should construct a bit based on the fetched opportunity details like `buy_tokens` and `sell_tokens`.
131+
The SDKs provide an easy way to construct a bid using the `OpportunityAdapter` contract.
132+
The `OpportunityAdapter` contract handles asset transfers and ensures the opportunity is executed correctly.
131133

132134
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.
133135
If you have already developed an in-house searcher contract there is no need to integrate using the Opportunity Adapter contract.
@@ -166,11 +168,11 @@ signed_bid = sign_bid(opportunity,
166168
OpportunityBidParams(amount=amount, deadline=int(deadline), nonce=nonce),
167169
private_key)
168170

169-
````
171+
```
170172
</Tabs.Tab>
171173
</Tabs>
172174

173-
### Submit bids on opportunities to the auction server.
175+
### Submit bids on opportunities to the auction server
174176

175177
Searchers can submit the constructed bids to the auction server via the SDKs, an HTTP POST request, or through a WebSocket connection.
176178

@@ -183,7 +185,7 @@ const handleOpporunity = async (opportunity: Opportunity) => {
183185
const bid = await client.signBid(opportunity, {amount, nonce, deadline},privateKey)
184186
await client.submitBid(bid)
185187
}
186-
````
188+
```
187189

188190
</Tabs.Tab>
189191
<Tabs.Tab>

0 commit comments

Comments
 (0)