-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to set gas price and gas limit for a trade ? #34
Comments
Duplicate of #23. You need to pass in a custom Web3 instance to the constructor, with the gas strategy that you want. See the Web3 docs for how to do that: https://web3py.readthedocs.io/en/stable/gas_price.html
There's a constructor parameter for that as well: https://github.com/shanefontaine/uniswap-python/blob/672ce87c9f330a20bb5f17742d65eafbaf484e80/uniswap/uniswap.py#L132 |
many thanks @ErikBjare |
@ErikBjare were you able to pass the instance to the constructor? And if yes, in which part of the uniswap.py script you added the instance from web3 ? |
@ErikBjare Could you please provide an example on this something like this doesn't work |
You need to pass a Web3 object, not a gas strategy object. Read the Web3py docs:
The For specifics on the behavior, see the first few lines of |
Hello @ErikBjare Thanks a lot. Correct. WHat I did was creating a w3 instance like this:
Then pass it through the w3 argument of the Uniswap constructor class. Seems it worked. But would you add this as a parameter on the class where we can specify the gwei directly? I think it's much easier. |
That would not be appropriate. It might make your code slightly shorter, but it unnecessarily complicates the code for uniswap-python to handle all the complexities of Web3 initialization and gas pricing strategies. As the Zen of Python states: "there should be one, and preferably only one, obvious way to do it" |
Thank you |
@Weizilla Makes an interesting point, any thoughts @ErikBjare? Was there a particular rationale behind this? |
Was a simple and quick way to make the transaction very fast found? I'm finding that using a custom web3 makes the process much slower, defeating the process of making the transaction faster. |
hi, using uniswap-python lib, Could I set the gas price and gas limit for the trade ?
seem I do not find this from readme document, please help
also have same question with slip page setting.
Do we support this in near future ?
The text was updated successfully, but these errors were encountered: