Skip to content

Commit 39bc95e

Browse files
authored
Update README.md
1 parent 697e3ed commit 39bc95e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,31 @@
1919
<a target="_blank" href="https://docs.chainstack.com/quickstart/">Blockchain API reference</a> •
2020
<a target="_blank" href="https://console.chainstack.com/user/account/create">Start for free</a>
2121
</p>
22+
# TLDR quick run
2223

24+
Download the latest Raydium mainnet.json to the project root (it's a ~500 MB file):
25+
26+
```
27+
wget https://api.raydium.io/v2/sdk/liquidity/mainnet.json
28+
```
29+
30+
Set the tokenA and tokenB in `src/swapConfig.ts`.
31+
32+
Now that you have the the 500 MB `mainnet.json` that has the entrirety of info on liquidity pairs, and you have the correct pairs set in `swapConfig.ts`, you want to trim the `mainnet.json` file to have only the necessary liquidity info pertaining to your tokenA & tokenB. So run:
33+
34+
```
35+
ts-node src/trimMainnet.ts
36+
```
37+
38+
This will produce `src/trimmed_mainnet.json` that takes less than a second to load vs minutes for `mainnet.json`.
39+
40+
Make sure you have the Chainstack node & your private key set in `.env`. Make sure you have all dependencies installed with `yarn`.
41+
42+
Run the swap:
43+
44+
```
45+
yarn swap
46+
```
2347
# Raydium SDK Swap Example
2448

2549
This project demonstrates how to perform a token swap on the Solana blockchain using Raydium and Chainstack. The example specifically illustrates swapping SOL (native Solana token) for USDC (a stablecoin).

0 commit comments

Comments
 (0)