raydium-io/raydium-sdk

Simulate transaction hiding rpc error

mdatsev opened this issue · 4 comments

Sometimes while calling Liquidity.fetchInfo a simulation fails but instead of rethrowing the error a new error with only a string message is thrown, thereby hiding the details from the rpc of why it failed. I am not sure how to reproduce the error because it only happens sometimes, but here is the relevant code:
https://github.com/raydium-io/raydium-sdk/blob/master/src/common/web3.ts#L264

The high probability of an error is due to the rpc rate limit.
You can increase the rate limit or reduce the number of data fetched at a time with paid rpc

I can confirm that this has nothing to do with the rpc rate limit. I went into the raydium SDK section that produces the error and output the error and I got the following:

{ InstructionError: [ 0, 'ProgramFailedToComplete' ] }

This looks like a program panic.

I still think it would be better if the actual error message from the rpc was shown instead of trying to guess 😒

Hi, we've released sdk-v2 and don't recommend using simulate to get the pool info.
You can switch the version to sdk-v2 and try again.