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/integrate-as-searcher/svm.mdx
+106-7Lines changed: 106 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ SVM Express Relay searchers fulfill opportunities representing limit orders on t
8
8
9
9
### Subscribe to New Opportunities
10
10
11
-
Express Relay provides searchers with [Typescript](https://github.com/pyth-network/per/tree/8e311d3dce7a54865ff98b25e57c6af2dd984d1f/sdk/js) and [Python](https://github.com/pyth-network/per/tree/8e311d3dce7a54865ff98b25e57c6af2dd984d1f/sdk/python) SDKs to interact with Express Relay.
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.
12
12
Searchers can also directly fetch available opportunities via HTTP or subscribe to them via WebSocket.
@@ -100,20 +100,119 @@ The server responds with opportunities in the following format:
100
100
### Construct the Bid
101
101
102
102
Searchers should construct a bid by evaluating the fetched opportunity.
103
-
The SDKs provide an easy way to construct a bid; refer to these basic examples in [Typescript](https://github.com/pyth-network/per/blob/0bd47e39d704c4b19b596512e4be05db4f715e58/sdk/js/src/examples/simpleSearcherLimo.ts#L75) and [Python](https://github.com/pyth-network/per/blob/0bd47e39d704c4b19b596512e4be05db4f715e58/sdk/python/express_relay/searcher/examples/simple_searcher_svm.py#L110).
104
103
105
104
<Callouttype="warning"emoji="⚠️">
106
-
Before constructing the bid, make sure your wallet has the required assets.
105
+
Before constructing the bid, make sure your wallet has the required assets to
106
+
fulfill the limit order and SOL to pay the bid amount.
107
107
</Callout>
108
108
109
-
The bid you construct will look like
109
+
See the following examples of how to construct a bid object via the SDKs:
110
110
111
+
<Tabsitems={['Typescript', 'Python']}>
112
+
<Tabs.Tab>
113
+
Below is an excerpt of example code. See the full example in the [Typescript SDK](https://github.com/pyth-network/per/blob/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/js/src/examples/simpleSearcherLimo.ts).
114
+
115
+
```typescript copy
116
+
import { OpportunitySvm } from"../index";
117
+
import { BidSvm } from"../types";
118
+
119
+
import*asanchorfrom"@coral-xyz/anchor";
120
+
import*aslimofrom"@kamino-finance/limo-sdk";
121
+
122
+
/**
123
+
* Generates a bid for a given opportunity. The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
Below is an excerpt of example code. See the full example in the [Python SDK](https://github.com/pyth-network/per/blob/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/python/express_relay/searcher/examples/simple_searcher_svm.py).
160
+
161
+
```python copy
162
+
import logging
163
+
164
+
from solders.transaction import Transaction
165
+
166
+
from express_relay.models.svm import BidSvm
167
+
from express_relay.svm.limo_client import OrderStateAndAddress
Method to assess an opportunity and return a bid if the opportunity is worth taking. This method always returns a bid for any valid opportunity. The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
175
+
176
+
Args:
177
+
opp: An object representing a single opportunity.
178
+
Returns:
179
+
A bid object if the opportunity is worth taking to be submitted to the Express Relay server, otherwise None.
0 commit comments