Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 8142

Is there any faster way to getPoolKeys from Solana Raydium?

$
0
0

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)};

Viewing all articles
Browse latest Browse all 8142

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>