Skip to content
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

feat: /swap endpoint #1269

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft

feat: /swap endpoint #1269

wants to merge 38 commits into from

Conversation

dohaki
Copy link
Contributor

@dohaki dohaki commented Nov 8, 2024

Epic branch for /swap endpoint

Copy link

vercel bot commented Nov 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app-frontend-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 2:59pm
sepolia-frontend-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 2:59pm

* feat: add exact output trade type support uniswap

* test with base

* fixup

* fixup

* fixup

* ci: fix dep review

* fixup

* test uniswap universal

* fixup

* test 1inch

* fixup

* fixup
api/_dexes/uniswap.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@pxrl pxrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dohaki Do we want to consider merging this into a feature branch? Or is that already what swap-endpoint is?

api/_dexes/uniswap.ts Outdated Show resolved Hide resolved
api/swap.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add Mainnet, Blast, World Chain & Zora here?

scripts/generate-routes.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooc, do we have a merge-time check that this file matches 1:1 the output of the generate-routes script? I could see how they could accidentally get out of sync on a long-running PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no we don't... we should add that to CI

@dohaki
Copy link
Contributor Author

dohaki commented Nov 14, 2024

@dohaki Do we want to consider merging this into a feature branch? Or is that already what swap-endpoint is?

Yea this branch is supposed to be the long-living epic branch actually. That's why I am keeping it in a draft state for now

* feat: cross swap quotes resolve uniswap min output

* add test script

* refine min output and leftover tokens handling
* resolve arbitrary token details

* fixup

* use wrapped addresses to resolve native tokens

* create error class, refactor using multicall

* Update api/_utils.ts

Co-authored-by: Dong-Ha Kim <[email protected]>

* validate inputs, add cause to error

---------

Co-authored-by: Dong-Ha Kim <[email protected]>
* feat: build cross swap tx

* fixup

* fixup

* refactor

* fix

* fixup

* fixup

* feat: add leftover handling type

* fixup

* fixup

* review requests
* feat: build cross swap tx

* fixup

* fixup

* refactor

* fix

* fixup

* fixup

* feat: add leftover handling type

* fixup

* fixup

* feat: support native eth as input/output

* review requests

* refactor leftover type into exact_output and min_output for clarity

* add temp swap and bridge typechain binding and use for testing

* fixup
* add utility for parsing query params with coercion for non string values

* extend api to accept tokenAdress & chainId

* bump sdk version

* bump sdk, fix build error

* small refactor

* update sdk
* update sdk

* measure by input type

* measure by cross swap type

* measure full run of endpoint

* use console instance without global loglevel restriction

* remove unnecessary awaits
* perf: only use indicative quotes

* add profiling

* add caching of indicative quotes

* fixup

* fixup

* fixup

* fixup

* add more profiling
* feat: support permit swap

* fixup

* refactor: swap test scripts

* wip

* feat: refactor + support permit

* fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants