I am building a sniper bot which continually estimating the gas for buying one token. Once the gas is successfully estimated, a transaction to buy the token is sent. But for many times it estimated the gas and sent the transaction, then the transactio failed because no liquidity was found. I checked the transaction history and found that my transaction was in front of the transaction which added the liquidity due the the difference of gas price.
So the question is, does that means the estimateGas method estimates gas according to the transactions being handled which may have not been included in a block already added to the chain?
Any information is highly appreciated!