feat(swap): curated asset list with search + logos, custom slippage#319
Open
Dgetsylver wants to merge 1 commit into
Open
feat(swap): curated asset list with search + logos, custom slippage#319Dgetsylver wants to merge 1 commit into
Dgetsylver wants to merge 1 commit into
Conversation
…318) Replace the hardcoded swap asset universe (SWAP_ASSETS + BROKER_TO_CONTRACT) with the LOBSTR curated feed (curated.json). Users browse or search assets (by code / name / domain / contract id — C… or raw hex) via a searchable picker with token logos, instead of two fixed dropdowns. Slippage adds a 4th "Custom" option: a numeric input accepting 0 < x ≤ 50, warned above 5%. - new views/swapAssets.ts: fetch + cache (in-memory + sessionStorage, 6h TTL), map each entry to { brokerId, contractId (StrKey from hex), icon, decimals, … }, inject synthetic native XLM, fall back to a built-in list on failure. - swap.ts: asset pills open a Modal picker; logos with letter-avatar fallback; custom-slippage validation + high-slippage warning; balance + Aquarius lookups now resolve via contractForBroker. Quote / DEX-rate / execute flow unchanged (execute still gated "coming soon"). - e2e/tests/swap.spec.ts: picker render, search-filter, select, slippage validation (deterministic via the fallback list). Verified: build + lint clean; hex→StrKey parity vs real contracts (USDC/EURC/AQUA); full e2e suite green (4/4).
Deploying turbolong-app with
|
| Latest commit: |
4f10a63
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b7cc330d.turbolong-app.pages.dev |
| Branch Preview URL: | https://feat-swap-curated-assets.turbolong-app.pages.dev |
Deploying turbolong-landing with
|
| Latest commit: |
4f10a63
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8db17578.turbolong-landing.pages.dev |
| Branch Preview URL: | https://feat-swap-curated-assets.turbolong-landing.pages.dev |
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.
Closes #318.
What
SWAP_ASSETS+BROKER_TO_CONTRACTwith the LOBSTR curated feed (https://lobstr.co/api/v1/sep/assets/curated.json, CORS*, ~51 assets). Newviews/swapAssets.tsfetches + caches (in-memory + sessionStorage, 6h TTL), maps each entry to{ brokerId, contractId, icon, decimals, … }, injects synthetic native XLM, and falls back to a small built-in list if the feed is unreachable.Modalsearch picker. Filters by code / name / domain / issuer / contract id, accepting both theC…StrKey and the raw 64-hex form. Curated-only: a pastedC…not in the feed shows "not in the curated list".icon, lazy-loaded, with a letter-avatar fallback on load error (pills + picker rows).0 < x ≤ 50; warns above 5%; flags out-of-range as invalid and blocks the quote.Unchanged
estimateSwap), DEX-rate cross-check (Aquarius), and the execute path — execution stays gatedSWAP_EXECUTE_ENABLED = false("coming soon"); the broker trade-XDR builder is still out of scope.Files
frontend/src/views/swapAssets.ts(new) ·frontend/src/views/swap.ts·frontend/src/views/swap.cssfrontend/e2e/tests/swap.spec.ts(new) — picker render, search-filter, select, slippage validationVerification
npm run build✓ ·npm run lint✓C…StrKey parity checked against real contracts (USDCCCW67TSZ…, EURCCDTKPWPL…, AQUA) — matches the previously hardcoded ids.Notes
network: "public"(mainnet); swap is a mainnet-routed feature.🤖 Generated with Claude Code