raydium-io / raydium-sdk-V2-demo

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

Program returned error: custom program error: 0x1d #34

Closed miaoluyao closed 4 months ago

miaoluyao commented 4 months ago

This txsolscan

`amm/swap const amountIn = 0.01 const poolId = 'EieyicTUK1iacEAd1eGeDasq9CijwBeqmtn3Rs8RpeA1' const out = raydium.liquidity.computeAmountOut({ poolInfo: { ...poolInfo, baseReserve: pool.baseReserve, quoteReserve: pool.quoteReserve, }, amountIn: new BN(amountIn), mintIn: poolInfo.mintB.address, // swap mintB -> mintA, use: poolInfo.mintB.address mintOut: poolInfo.mintA.address, // swap mintB -> mintA, use: poolInfo.mintA.address slippage: 0.9, // range: 1 ~ 0.0001, means 100% ~ 0.01% })

const { execute } = await raydium.liquidity.swap({ poolInfo, amountIn: new BN(amountIn), amountOut: out.minAmountOut, // out.amountOut means amount 'without' slippage fixedSide: 'in', inputMint: poolInfo.mintB.address, // swap mintB -> mintA, use: poolInfo.mintB.address associatedOnly: false, txVersion, // optional: set up priority fee here computeBudgetConfig: { units: 600000, microLamports: 289137, }, })`