osmosis-frontend
osmosis-frontend copied to clipboard
Support swap exact amount out
We have implemented all of the pool math/estimates to allow for swapping for a desired out amount. We should allow for this in the frontend.
The simplest approach is to copy what uniswap does by simply allowing the user to type into the "To" amount input. The "From" field will be populated based on pool weight calculations.
Adding to icebox since it hasn't been requested by users.
@sunnya97 and I agree this is a super valuable thing to add.
Not a good first issue since it would require updates to the pool swap router
https://app.clickup.com/t/8677f67a0
Reopen when planning dev
Implementation notes:
- Most work will be done in the trade clipboard component
- We have an ObservableTradeTokenInConfig, but you may want to make another MobX store for trading the out token.
- There may or may not need to be changes to the router
- The math/quote generation logic should all be there, it's currently unused. So you'll mostly be dealing with UI logic and wiring.
- We may need to add the multihop swap exact amount out message (for swapping through multiple pools). It should be nearly identical to the swap exact amount in message in the account store. We already have the swap exact amount out message (for swapping through a single pool).
@jonator I've pushed a PR with some progress on this. Details are in the PR.
Closing in favor of tracking on ClickUp