feat(explorer): Lithoswap swap UI (/swap) — item 1 frontend - #69
Open
bachal-mb wants to merge 1 commit into
Open
feat(explorer): Lithoswap swap UI (/swap) — item 1 frontend#69bachal-mb wants to merge 1 commit into
bachal-mb wants to merge 1 commit into
Conversation
Adds the same-chain swap front-end for the Lithoswap V2 DEX (PR for the contracts is separate): - lib/swap.ts — ethers v6 client for the Lithoswap router: read-only quotes via getAmountsOut against rpc.litho.ai, WLITHO-based path routing (token→WLITHO→token when there's no direct pair), slippage/min-out, approve + swapExactTokensForTokens through the connected wallet, and an actionable error decoder. Reuses the bridge's token list and approveIfNeeded. - pages/swap.tsx — the /swap page: token in/out selectors, debounced live quote, slippage tolerance, minimum-received + route display, and a Makalu chain-switch gate (same pattern as /bridge). - Header: adds "Swap" to the nav and points the wallet-menu Swap entry at /swap (it was a stopgap link to /bridge). The router address is injected as NEXT_PUBLIC_SWAP_ROUTER at build time once the DEX is deployed; until then isSwapConfigured() is false and the page shows a clear "not live yet" state instead of calling a zero address — so this is safe to ship ahead of the on-chain deploy. Verified: tsc clean (aside from the pre-existing build-info.test.ts errors) and `next build` compiles /swap as a static route.
Test Results
Coverage
Generated by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(explorer): Lithoswap swap UI (/swap) — item 1 frontend
Adds the same-chain swap front-end for the Lithoswap V2 DEX (PR for the
contracts is separate):
via getAmountsOut against rpc.litho.ai, WLITHO-based path routing
(token→WLITHO→token when there's no direct pair), slippage/min-out,
approve + swapExactTokensForTokens through the connected wallet, and an
actionable error decoder. Reuses the bridge's token list and approveIfNeeded.
quote, slippage tolerance, minimum-received + route display, and a Makalu
chain-switch gate (same pattern as /bridge).
/swap (it was a stopgap link to /bridge).
The router address is injected as NEXT_PUBLIC_SWAP_ROUTER at build time once
the DEX is deployed; until then isSwapConfigured() is false and the page shows
a clear "not live yet" state instead of calling a zero address — so this is
safe to ship ahead of the on-chain deploy.
Verified: tsc clean (aside from the pre-existing build-info.test.ts errors)
and
next buildcompiles /swap as a static route.