uniswap-python / uniswap-python

🦄 The unofficial Python client for the Uniswap exchange.
https://uniswap-python.com
MIT License
949 stars 372 forks source link

Feature Request: Adding functionality for custom signing #281

Open pmantica3 opened 2 years ago

pmantica3 commented 2 years ago

Thanks for the awesome library!

I have a feature request. I would like to be able to use uniswap python without using my private keys. In other words, it would be great if you could expose an API that creates the uniswap transactions but doesn't sign them / deploy them. This would allow me to use python uniswap with external signing applications like Fireblocks, that allow me to set custom rules to make sure that your crypto is not sent to addresses that don't belong to me.

mdigi14 commented 2 years ago

@ErikBjare @KeremP I can take a pass at this. It makes a lot of sense if you want to layer this library with something like flashbots.

I was thinking of adding class wide variables like 'shouldSign' and 'shouldBroadcast' and then adding some logic to the '_build_and_send_tx' function in uniswap.py to return unsigned or signed txs w/o broadcasting.

I think this might cause some issues with the tests in 'test_uniswap.py' because they expect a 'status' field to be returned from some tests. Let me know if you think my approach makes sense w.r.t the rest of the library and I can make a quick PR sometime this week and we can figure out what to do about the tests.

ErikBjare commented 2 years ago

@mdigi14 Go for it! :)