joshstevens19 / simple-uniswap-sdk

Uniswap SDK which handles the routes automatically for you, changes in trade quotes reactive subscriptions, exposure to formatted easy to understand information, bringing back the best trade quotes automatically, generating transactions for you and much more.
MIT License
188 stars 95 forks source link

Gas limit override feature #26

Closed dec0dOS closed 2 years ago

dec0dOS commented 2 years ago

Hello, thanks for the awesome project! Simple-uniswap-sdk is really useful!

I have a problem with the automatic gas limit detection. It is often set for a too-small value, so I keep getting the Warning! Error encountered during contract execution [Out of gas] on my trade transactions. Is there any way to manually set the Gas Limit?

joshstevens19 commented 2 years ago

Hey the sdk only returns you the tx without any gas limit defined its up you to fill the gaps with it yourself. If you don’t and send it to web3 or ethers it will try to estimate it for you.

We just return:

transaction: { to: string; from: string; data: string; value: string; };

to set you can just set it on that transaction object aka transaction.gas = xxxx etc etc

hope this helps!