Is there any faster way to getPoolKeys from Solana Raydium?
Is there any faster way to getPoolKeys from Solana Raydium?
Loading saved threads...
Shahria Emon · External communityPost link
External question — Solana Stack Exchange
Author: Shahria Emon
Original post: https://solana.stackexchange.com/questions/15368
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Currently, I am fetching all liquidity-related data from Raydium API. (
https://api.raydium.io/v2/sdk/liquidity/mainnet.json
)
And then matching with my desired token address to filter the right PoolKeys. But this process is taking too much time. Is there any way to do it faster?
Here is my code snippet
// Pass both token addresses (mint), and it will return the data of the pool of those tokens.
const getPoolKeys = async (tokenA, tokenB) => {
const liquidityJsonResp = await fetch(liquidityFile);
if (!liquidityJsonResp.ok) return
const liquidityJson = await liquidityJsonResp.json()
const allPoolKeysJson = [...(liquidityJson?.official ?? []), ...(liquidityJson?.unOfficial ?? [])]
const poolData = allPoolKeysJson.find(
(i) => (i.baseMint === tokenA && i.quoteMint === tokenB) || (i.baseMint === tokenB && i.quoteMint === tokenA)
)
if (!poolData) return null
return jsonInfo2PoolKeys(poolData)
};
Quote
Report
Ake · External communityPost link
External answer — Solana Stack Exchange
Author: Ake
Original post: https://solana.stackexchange.com/a/15769
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I didn't find a better way either, so what I did is to get that mainnet.json and then trim it for the necessary tokens, and then just use the trimmed mainnet.json.
I added it here
Solana: How to perform token swaps using the Raydium SDK
Quote
Report
Shahria Emon · External communityPost link
External answer — Solana Stack Exchange
Author: Shahria Emon
Original post: https://solana.stackexchange.com/a/15945
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I have found a faster and better solution. Check this repo
https://github.com/CoreDevsLtd/getPools_solana_raydium
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Solana Stack Exchange Author: Shahria Emon Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/a/15945 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have found a faster and better solution. Check this repo https://github.com/CoreDevsLtd/getPools_solana_raydium
Checking account access…