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
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.
77
78
78
79
You can fetch historical opportunities by setting the `mode` parameter to `historical`.
79
80
80
81
</Tabs.Tab>
81
82
<Tabs.Tab>
82
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`)
83
-
Here is a sample json payload to subscribe to opportunities:
84
+
Here is a sample JSON payload to subscribe to opportunities:
84
85
85
-
```json copy
86
+
```bash copy
86
87
{
87
88
"id": "1",
88
89
"method": "subscribe",
@@ -99,13 +100,13 @@ Consult [`Websocket API reference`](./websocket-api-reference.mdx) for a complet
99
100
100
101
The server responds with opportunities in the following format:
101
102
102
-
```json copy
103
+
```bash copy
103
104
{
104
-
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
105
+
"target_calldata": "0xdeadbeef", // Calldata to execute the opportunity
105
106
"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.
109
110
"buy_tokens": [
110
111
// Tokens to buy
111
112
{
@@ -120,14 +121,15 @@ The server responds with opportunities in the following format:
### Evaluating the opportunity and constructing the bid
128
+
### Evaluate the opportunity and construct the bid
128
129
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.
131
133
132
134
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
135
If you have already developed an in-house searcher contract there is no need to integrate using the Opportunity Adapter contract.
0 commit comments