raydium-io / raydium-sdk-V2

Open-source Typescript SDK for Raydium
GNU General Public License v3.0
87 stars 49 forks source link

raydiumSdk routeSwap with 429 Too Many Requests #55

Closed mianshenglee closed 2 days ago

mianshenglee commented 4 days ago

i'm using raydiumSdk to do routeSwap like the demo :https://github.com/raydium-io/raydium-sdk-V2-demo/blob/master/src/trade/routeSwap.ts, but when the program exec raydiumSdk.tradeV2.fetchSwapRoutesData, it will cause this error: Server responded with 429 Too Many Requests. Retrying after 500ms delay..., at last throw this exception : Error: failed to get info for multiple accounts, RPC_ERROR, 429 Too Many Requests.

since my rpc is paid , so i think the sdk do calling rpc too many times some way.

i check out the sdk source and find getMultipleAccountsInfo function, this :await Promise.all(_batch.map(async (i) => await (connection as any)._rpcBatchRequest(i))). it will call rpc many times .... why the sdk do that ?

any one can help me out how to solve this problem?

cruzshia commented 2 days ago

I think you have to upgrade your pard rpc subscription plan, all rpc call are needed when generating route swap