Frontend: Portfolio phase 2 — wallet-wide limits, LP overview, unrealized P&L #217
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#217
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow-up to GitLab #212 (My Portfolio MVP on
/portfolio). Phase 1 shipped wallet-centric summary, open quote positions, and recent swaps from existing trader indexer APIs. Phase 2 extends the portfolio into a fuller wallet-home surface without changing position accounting unless scoped separately.Depends on: #212 (landed on
main—658e5fe).Goals
Current gaps (post–#212)
GET /api/v1/pairs/{addr}/limit-placementsper pair; client filters by wallet on Trade/LimitsGET /api/v1/traders/{addr}/limit-placements(or equivalent)PoolPageper pair via LCDRecommended approach
A. Wallet-wide limits (highest product value)
Option 1 (preferred if agreed): New indexer endpoint, e.g.
GET /api/v1/traders/{addr}/limit-placementswith pagination,statusfilter parity with pair route, caps (limit≤ 200).Option 2 (frontend-only fallback): Fan-out
limit-placementsover indexed pairs with strict concurrency cap (e.g. 5), max pairs (e.g. 50), loading skeletons, and documented degradation — defer if Option 1 is in scope.UI: New Open limits section on
/portfolio(table or compact list); actions deep-link to/trade/{pair}or/limits(cancel still via existing flows — no new signing surface on portfolio unless explicitly added).B. LP overview
balancefor LP CW20 tokens across factory pairs, or indexer enhancement if LP positions are indexed later.TraderPositionsTabledisclaimer).C. Unrealized P&L (optional / blocked on API)
Constraints (carry forward from #212)
/trader/:address.MarketDataServiceOutageBanner+RetryErrorparity.aria-label, keyboard-navigable links.Acceptance criteria
/portfolioshows Open limits for connected wallet (or clear “not available” if indexer endpoint deferred)./pool/ pair trade.PortfolioPage.test.tsx,e2e/portfolio.spec.ts).docs/frontend.md§ My Portfolio +skills/AGENTS_FRONTEND_PORTFOLIO.mdupdated.References
docs/frontend.md#my-portfolioskills/AGENTS_FRONTEND_PORTFOLIO.mddocs/indexer-invariants.mdLimitOrderMyPlacementsPanelmentioned in issue #212
mentioned in commit
9edb0cbac0Implementation summary (merged to
main—9edb0cb)Portfolio phase 2 for #217 is landed.
What changed
Indexer (Option 1 — preferred)
GET /api/v1/traders/{addr}/limit-placements— wallet-wide open limits filtered by indexedowner, with the same cancel omission,lifecycle_status, and?status=semantics as the pair route (limit≤ 200).docs/indexer-invariants.md.Frontend
/portfolio/trade/{pair}and/limits(read-only; no new signing surface).usePortfolioLpBalances; clearly separated from trader quote positions.Docs / agents
docs/frontend.md§ My Portfolio andskills/AGENTS_FRONTEND_PORTFOLIO.md.Verification checklist
/portfolioshows Open limits and LP overview sections (plus existing positions / recent activity).GET /api/v1/traders/{your-addr}/limit-placementsreturns your resting limits (active + parked_expired by default); cancelled orders omitted.MarketDataServiceOutageBanneron portfolio indexer sections.PortfolioPage.test.tsx,client.test.ts; indexer:get_trader_limit_placements_*inapi_traders.rs.e2e/portfolio.spec.ts(5 workers).@brouie — please verify on a wallet with known open limits and LP on localnet or staging when convenient. Leaving this issue open until sign-off.
mentioned in commit
9e52ac2d6aVerification complete (agent — issue #217)
Verified portfolio phase 2 on
main(worktreeverify/issue-217, merged9e52ac2).What was verified
Acceptance criteria (issue body)
GET /api/v1/traders/{addr}/limit-placements) indocs/frontend.md§ My Portfolio,docs/indexer-invariants.md,skills/AGENTS_FRONTEND_PORTFOLIO.md./portfolioOpen limits —PortfolioOpenLimitsSectionviagetTraderLimitPlacements; Playwright connected-wallet test seesportfolio-open-limits-section.PortfolioLpOverviewSection+usePortfolioLpBalances(50-pair / concurrency-5 cap); copy separates LP from quote exposure; links to/pool.PortfolioPage.test.tsx(6/6), Playwrighte2e/portfolio.spec.ts(4/4, 5 workers).get_trader_limit_placements_*inapi_traders.rs.Prior comment checklist
GET /api/v1/traders/terra1x46…/limit-placementsreturns wallet-wide resting limits (owner-filtered, cancelled omitted).aria-label="Open limit orders"and pair links to/trade/{pair}; copy points to/limitsfor cancel/claim.MarketDataServiceOutageBanner+RetryErrorparity) — code review + existing outage patterns.Fix landed during verification
indexer/tests/api_traders.rs— addedserial_test::serialon all trader API integration tests (same pattern asapi_pairs.rs). Without this, parallelseed_dbon shareddex_indexer_testcaused flakyget_trader_limit_placements_returns_owner_rows(0 rows vs expected 1). Pushed tomainas9e52ac2.Manual re-check checklist (optional)
/portfolioshows summary, positions, Open limits (rows if any), LP overview, recent activity./trade/{pairAddr}.Closing — all issue-body acceptance criteria and automated verification pass.
Verification complete (agent — focus re-check #217)
Worktree:
verify/issue-217@cc86088(merged tomain, no code changes).Focus areas (requested)
/portfolio+ dev wallet (terra1x46…k38v) — positions match indexer APIGET /api/v1/traders/{addr}/positions→ 25 rows.Open positionstable → 25 rows; pair labels match (e.g. first rowEMBER/CORAL).LP overview loads after
9e24606Failed to load LP balances; invalid-token skip path from9e24606exercised via VitestusePortfolioLpBalances.test.ts.Mobile + desktop nav; dark/light theme on portfolio sections
nav.app-desktop-navshows Portfolio in primary nav.nav.app-mobile-nav-shellshows Portfolio; desktop nav hidden.--ink: #fff7ee) and Light (--ink: #43261b) both render all four sections (positions, open limits, LP overview, recent activity).Automated checks
PortfolioPage.test.tsx,client.test.ts,usePortfolioLpBalances.test.ts— 20/20 passe2e/portfolio.spec.ts(5 workers) — 4/4 passapi_tradersget_trader_limit_placements_*— 2/2 passManual checklist (optional follow-up)
/trade/{pair}portfolio-lp-emptyempty stateportfolio-market-data-outage-banner+ RetryNote: Indexer CORS allows
localhost:3000/127.0.0.1:3000only — use port 3000 for browser QA (arbitrary Vite ports show outage until CORS origin is added).All issue-body acceptance criteria and the three focus items pass. Closing.
mentioned in issue #337
mentioned in issue #419