EatTheBlocks Forum

348-pancakeswap-trading-bot Gas Limit Set Gas

I am getting an gas estimation error in the pancakeswap trading bot I have everything else working the WBNB approval goes through and gives me a transaction receipt but when I go to swap tokens… it gives me a gas estimation error. I would like to just set the gas limit and set gas. I understand this needs to be added to the transaction I just don’t know where to do it.


const tx = await router.swapExactTokensForTokens(
[tokenIn, tokenOut],
Math.floor( / 1000) + 60 * 3, // 20 minutes from the current Unix time
gasPrice: 5,
gasLimit: 210000