Skip to content

Commit 993c5f3

Browse files
committed
update new opportunity stuff
1 parent 67dba48 commit 993c5f3

File tree

1 file changed

+25
-11
lines changed
  • pages/express-relay/integrate-as-searcher

1 file changed

+25
-11
lines changed

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Callout, Tabs, Steps } from "nextra/components";
22

33
# SVM Searcher Integration
44

5-
SVM Express Relay searchers fulfill opportunities representing limit orders on the [Limo]() program.
5+
SVM Express Relay searchers fulfill opportunities representing limit orders on the [Limo](https://explorer.solana.com/address/LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF) program.
66

77
<Steps>
88

@@ -19,39 +19,53 @@ Pyth provides a Typescript SDK, which allows searchers to subscribe to opportuni
1919
```typescript
2020
import { Client, Opportunity } from "@pythnetwork/express-relay-js";
2121

22-
const handleOpporunity = async (opportunity: Opportunity) => {
22+
const handleOpportunity = async (opportunity: Opportunity) => {
23+
console.log("Received opportunity");
2324
// Implement your opportunity handler here
2425
};
2526

2627
const client = new Client(
2728
{ baseUrl: "https://pyth-express-relay-mainnet.asymmetric.re" },
2829
undefined, // Default WebSocket options
29-
handleOpporunity
30+
handleOpportunity
3031
);
31-
await client.subscribeChains(["development-solana"]);
32+
33+
async function main() {
34+
await client.subscribeChains(["solana"]);
35+
}
36+
37+
main();
3238
```
3339

3440
</Tabs.Tab>
3541
<Tabs.Tab>
3642
Pyth provides a Python SDK, which allows searchers to subscribe to opportunities:
3743

3844
```python copy
45+
import asyncio
3946
from express_relay.client import (
4047
ExpressRelayClient,
4148
)
42-
from express_relay.express_relay_types import Opportunity
49+
from express_relay.models import Opportunity
4350

44-
def opportunity_callback(opportunity: Opportunity):
51+
async def opportunity_callback(opportunity: Opportunity):
52+
print("Received opportunity")
4553
# Implement your opportunity handler here
46-
pass
4754

4855
client = ExpressRelayClient(
49-
"https://per-staging.dourolabs.app",
56+
"https://pyth-express-relay-mainnet.asymmetric.re",
5057
None,
5158
opportunity_callback,
5259
None,
5360
)
54-
await client.subscribe_chains(['development-solana'])
61+
62+
async def main():
63+
await client.subscribe_chains(["solana"])
64+
task = await client.get_ws_loop()
65+
await task
66+
67+
if __name__ == "__main__":
68+
asyncio.run(main())
5569
```
5670

5771
</Tabs.Tab>
@@ -60,7 +74,7 @@ Searchers can request opportunities through an HTTP **GET** call to the [`/v1/op
6074

6175
```bash copy
6276
curl -X 'GET' \
63-
'https://pyth-express-relay-mainnet.asymmetric.re/v1/opportunities?chain_id=development-solana&mode=live'
77+
'https://pyth-express-relay-mainnet.asymmetric.re/v1/opportunities?chain_id=solana&mode=live'
6478
```
6579

6680
Opportunities are short-lived and could be executed in a matter of seconds. So, the above endpoint could return an empty response.
@@ -75,7 +89,7 @@ Here is a sample JSON payload to subscribe to opportunities:
7589
"id": "1",
7690
"method": "subscribe",
7791
"params": {
78-
"chain_ids": ["development-solana"]
92+
"chain_ids": ["solana"]
7993
}
8094
}
8195
```

0 commit comments

Comments
 (0)