raydium-io / raydium-sdk-V2-demo

Open-source Typescript SDK demos
50 stars 31 forks source link

when i run addLiquidity.ts get error #36

Closed chatTeap closed 4 months ago

chatTeap commented 4 months ago

I have created the ammpool (V4jgEzY9ky7FVzMzb67NMi8miwF4PSv7NMb9kA3UWii) using /src/amm/createAmmPool.ts in the demo, and while creating the ammpool, I have set the amounts for mintA, mintB (where mintA=1B, mintB=10sol), and Sol has already been scored into the pool. I understand that I still need to use addLiquidity.ts to complete the final action of adding the pool (actually I don't quite understand why I still need to run addLiquidity, what is his point). When I try to run addLiquidity.ts, inputAmount after I set it, I always get the error: program returned error: custom program error: 0x1e, I have tried to adjust the values of inputAmount, slippage, but none of them work. Please help me!

cruzshia commented 4 months ago

you set wrong pool openTime with value (1718173800000) which is in milliseconds, but the open time required for create pool should be in seconds unit, so the pool status is not open, that's why you can't add liquidity.

chatTeap commented 4 months ago

you set wrong pool openTime with value (1718173800000) which is in milliseconds, but the open time required for create pool should be in seconds unit, so the pool status is not open, that's why you can't add liquidity.

Thank you. If I set the correct openTime in createAmmPool, do I need to use addLiquidity.ts again in order to enable SPL Token transactions?

cruzshia commented 4 months ago

no needed, create pool instructions include add initial liquidity, so you don't have to do it with another add liquidity tx.