raydium-io / raydium-sdk

An SDK for building applications on top of Raydium.
https://sdk.raydium.io
GNU General Public License v3.0
359 stars 139 forks source link

LP File #78

Open jlescalonap opened 7 months ago

jlescalonap commented 7 months ago

There is a problem when trying to fetch the LP-File (https://api.raydium.io/v2/sdk/liquidity/mainnet.json), most of times it does not retrieve any information or responds as null, só the flow breaks and the swap is not finished.

My config file is:

export const swapConfig = {
  executeSwap: false,
  useVersionedTransaction: true,
  tokenAAmount: 0.01,
  tokenAAddress: 'So11111111111111111111111111111111111111112',
  tokenBAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
  maxLamports: 1500000,
  direction: 'in' as 'in' | 'out',
  liquidityFile: 'https://api.raydium.io/v2/sdk/liquidity/mainnet.json',
  maxRetries: 20,
}

And the function that tries to fetch the liquidity file is:

await raydiumSwap.loadPoolKeys(swapConfig.liquidityFile)

I took the whole structure and functions from an example repo: https://github.com/chainstacklabs/raydium-sdk-swap-example-typescript

rudy5348 commented 7 months ago

I think you can start by investigating whether the data was successfully retrieved from API.

benjiqq commented 6 months ago

@jlescalonap works ok, but its a big file, its circa 300'000 entires, 300MB

brooke007 commented 4 months ago

@jlescalonap works ok, but its a big file, its circa 300'000 entires, 300MB

how you fetch the file, I tried to get the api, but it always return a network error. like this

image