@@ -2,7 +2,7 @@ import { Callout, Tabs, Steps } from "nextra/components";
2
2
3
3
# SVM Searcher Integration
4
4
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.
6
6
7
7
<Steps >
8
8
@@ -19,39 +19,53 @@ Pyth provides a Typescript SDK, which allows searchers to subscribe to opportuni
19
19
``` typescript
20
20
import { Client , Opportunity } from " @pythnetwork/express-relay-js" ;
21
21
22
- const handleOpporunity = async (opportunity : Opportunity ) => {
22
+ const handleOpportunity = async (opportunity : Opportunity ) => {
23
+ console .log (" Received opportunity" );
23
24
// Implement your opportunity handler here
24
25
};
25
26
26
27
const client = new Client (
27
28
{ baseUrl: " https://pyth-express-relay-mainnet.asymmetric.re" },
28
29
undefined , // Default WebSocket options
29
- handleOpporunity
30
+ handleOpportunity
30
31
);
31
- await client .subscribeChains ([" development-solana" ]);
32
+
33
+ async function main() {
34
+ await client .subscribeChains ([" solana" ]);
35
+ }
36
+
37
+ main ();
32
38
```
33
39
34
40
</Tabs.Tab >
35
41
<Tabs.Tab >
36
42
Pyth provides a Python SDK, which allows searchers to subscribe to opportunities:
37
43
38
44
``` python copy
45
+ import asyncio
39
46
from express_relay.client import (
40
47
ExpressRelayClient,
41
48
)
42
- from express_relay.express_relay_types import Opportunity
49
+ from express_relay.models import Opportunity
43
50
44
- def opportunity_callback (opportunity : Opportunity):
51
+ async def opportunity_callback (opportunity : Opportunity):
52
+ print (" Received opportunity" )
45
53
# Implement your opportunity handler here
46
- pass
47
54
48
55
client = ExpressRelayClient(
49
- " https://per-staging.dourolabs.app " ,
56
+ " https://pyth-express-relay-mainnet.asymmetric.re " ,
50
57
None ,
51
58
opportunity_callback,
52
59
None ,
53
60
)
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())
55
69
```
56
70
57
71
</Tabs.Tab >
@@ -60,7 +74,7 @@ Searchers can request opportunities through an HTTP **GET** call to the [`/v1/op
60
74
61
75
``` bash copy
62
76
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'
64
78
```
65
79
66
80
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:
75
89
" id" : " 1" ,
76
90
" method" : " subscribe" ,
77
91
" params" : {
78
- " chain_ids" : [" development- solana" ]
92
+ " chain_ids" : [" solana" ]
79
93
}
80
94
}
81
95
```
0 commit comments