-
Notifications
You must be signed in to change notification settings - Fork 42
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
base: master
Are you sure you want to change the base?
feat: /swap
endpoint
#1269
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
* 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
export const SWAP_ROUTER_02_ADDRESS = { | ||
[CHAIN_IDs.ARBITRUM]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", | ||
[CHAIN_IDs.BASE]: "0x2626664c2603336E57B271c5C0b26F421741e481", | ||
[CHAIN_IDs.BLAST]: "0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66", | ||
[CHAIN_IDs.MAINNET]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", | ||
[CHAIN_IDs.OPTIMISM]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", | ||
[CHAIN_IDs.POLYGON]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", | ||
[CHAIN_IDs.WORLD_CHAIN]: "0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6", | ||
[CHAIN_IDs.ZK_SYNC]: "0x99c56385daBCE3E81d8499d0b8d0257aBC07E8A3", | ||
[CHAIN_IDs.ZORA]: "0x7De04c96BE5159c3b5CeffC82aa176dc81281557", | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all checked out OK 👍
There was a problem hiding this 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?
swap.tokenIn = getMainnetToken(swap.tokenIn); | ||
swap.tokenOut = getMainnetToken(swap.tokenOut); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMainnetToken()
is existing functionality, but ooc, is it intending to distinguish testnet from mainnet? There's an unfortunate collision between mainnet (Ethereum) vs other chains and mainnet vs. testnet. If it's intending to distinguish testnet from prod, should we consider renaming it to getProdToken()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea getProdToken
is a better name def. Will change!
originChainId: positiveIntStr(), | ||
destinationChainId: positiveIntStr(), | ||
recipient: validAddress(), | ||
integratorId: string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we intend for this to be a required input? Seems like it's a value-add, but making it mandatory might be heavy-handed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, yea we can make it optional
There was a problem hiding this comment.
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?
[CHAIN_IDs.OPTIMISM]: "0x3E7448657409278C9d6E192b92F2b69B234FCc42", | ||
[CHAIN_IDs.ARBITRUM]: "0xC456398D5eE3B93828252e48beDEDbc39e03368E", | ||
[CHAIN_IDs.BASE]: "0x7CFaBF2eA327009B39f40078011B0Fb714b65926", | ||
[CHAIN_IDs.POLYGON]: "0xF9735e425A36d22636EF4cb75c7a6c63378290CA", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any deployment for 1inch in this pr - is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I actually deployed one for Polygon already back then when we introduced the initial swap feature
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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]>
Epic branch for /swap endpoint