Repository navigation
Add key depth chart to key detail page - #1261
Merged
Merged
Conversation
|
@assumptaamara Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Adds a Depth tab to the key detail price panel that visualises the
secondary-market order book, so traders can see resting liquidity (buy
orders and sell listings at each price level) before swapping.
What changed
src/services/keyDepth.service.ts(new) —GET /keys/:keyId/depth?levels=20,with a tolerant normaliser that accepts array or price-keyed ladders, XLM or
stroop prices, and
depth/orderBookenvelopes.src/hooks/useKeyDepth.ts(new) — React Query hook polling every 5s(
staleTime/refetchInterval).src/utils/keyDepthChart.utils.ts(new) — pure chart model: cumulativebid/ask ladders, best bid/ask, mid price, spread and spread %, plus a price
domain symmetric around the mid.
src/components/common/KeyDepthChart.tsx(new) — mirrored Recharts areachart (green bids left, red asks right), mid-price marker and spread badge
at the centre, summary chips, and loading/empty/error states.
src/pages/CreatorDetailPage.tsx— price-panel tabs are now driven by aPRICE_CHART_TABSlist with the newDepthentry.src/lib/queryKeys.ts— addedqueryKeys.creators.depth(creatorId, levels).Behaviour
bid and ask is shown at the centre of the plot; the same values are exposed
as summary chips.
initial load, so polls never flash or remount the chart.
gutter) and scales with the panel via
ResponsiveContainer.Tests
Added coverage:
keyDepth.service.test.ts,keyDepthChart.utils.test.ts,useKeyDepth.test.tsx,KeyDepthChart.test.tsxandCreatorDetailPage.depthTab.integration.test.tsx.Note for review
The endpoint payload shape is inferred from the issue, so the client-side
normaliser is deliberately permissive. If the backend uses different field
names, only
keyDepth.service.tsneeds to change.