@@ -24,39 +24,41 @@ Searchers can also directly fetch available opportunities via HTTP or subscribe
24
24
<Tabs items = { [' Typescript' , ' Python' , ' HTTP' , ' WebSocket' ]} >
25
25
26
26
<Tabs.Tab >
27
+
27
28
``` typescript
28
29
import { Client , Opportunity } from " @pythnetwork/express-relay-js" ;
29
30
30
31
latestChainUpdate : Record < string , SvmChainUpdate > = {}
31
32
32
33
const handleOpportunity = async (opportunity : Opportunity ) => {
33
- console .log (" Received opportunity" );
34
- // Implement your opportunity handler here
34
+ console .log (" Received opportunity" );
35
+ // Implement your opportunity handler here
35
36
};
36
37
37
38
const svmChainUpdateHandler = async (update : SvmChainUpdate ) {
38
- // Store chain updates to use when constructing the transaction
39
- latestChainUpdate[update .chainId ] = update;
39
+ // Store chain updates to use when constructing the transaction
40
+ latestChainUpdate[update .chainId ] = update;
40
41
}
41
42
42
43
const client = new Client(
43
- { baseUrl: " https://pyth-express-relay-mainnet.asymmetric.re" },
44
- undefined, // Default WebSocket options
45
- handleOpportunity,
46
- undefined,
47
- svmChainUpdateHandler
44
+ { baseUrl: " https://pyth-express-relay-mainnet.asymmetric.re" },
45
+ undefined, // Default WebSocket options
46
+ handleOpportunity,
47
+ undefined,
48
+ svmChainUpdateHandler
48
49
);
49
50
50
51
async function main() {
51
- await client .subscribeChains ([" solana" ]);
52
+ await client .subscribeChains ([" solana" ]);
52
53
}
53
54
54
55
main ();
55
56
56
- ````
57
+ ```
57
58
58
59
</Tabs.Tab >
59
60
<Tabs.Tab >
61
+
60
62
``` python copy
61
63
import asyncio
62
64
from express_relay.client import (
@@ -89,7 +91,7 @@ async def main():
89
91
90
92
if __name__ == " __main__" :
91
93
asyncio.run(main())
92
- ` ` ` `
94
+ ```
93
95
94
96
</Tabs.Tab >
95
97
<Tabs.Tab >
@@ -143,6 +145,7 @@ The server responds with opportunities in the following format:
143
145
The ` order ` field includes the [ Limo] ( https://solscan.io/account/LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF ) program
144
146
order data that can be decoded using the SDKs provided or the program anchor idl. It includes all the necessary information
145
147
to fill the limit order:
148
+
146
149
- Maker address
147
150
- Input token and amount (what the maker is selling)
148
151
- Output token and amount (what the maker is buying in exchange for the input token)
@@ -304,13 +307,14 @@ The bid you construct will look like
304
307
` ` `
305
308
306
309
The transaction submitted to the auction server as the bid should meet the following criteria :
307
- - It should contain an Express Relay ` SubmitBid ` instruction that specifies the amount you are bidding , the permission details , and the deadline.
308
- This instruction can be created via the SDKs.
309
- - The deadline specified in the ` SubmitBid ` instruction should be at least 5 seconds in the future.
310
- - It should contain an instruction to set the [transaction priority fee ](https : // solana.com/developers/guides/advanced/how-to-use-priority-fees#what-are-priority-fees). The priority fee should be at least as large the amount
311
- advertised via websocket .
312
- - It should contain valid signatures for all signers except the relayer
313
- - It should pass simulation
310
+
311
+ - It should contain an Express Relay ` SubmitBid ` instruction that specifies the amount you are bidding , the permission details , and the deadline.
312
+ This instruction can be created via the SDKs.
313
+ - The deadline specified in the ` SubmitBid ` instruction should be at least 5 seconds in the future.
314
+ - It should contain an instruction to set the [transaction priority fee ](https : // solana.com/developers/guides/advanced/how-to-use-priority-fees#what-are-priority-fees). The priority fee should be at least as large the amount
315
+ advertised via websocket .
316
+ - It should contain valid signatures for all signers except the relayer
317
+ - It should pass simulation
314
318
315
319
### Submit Bids on Opportunities to Express Relay
316
320
0 commit comments