Skip to content

feat: show 24h TWAP price on key detail page - #852

Open
mayborn005 wants to merge 5 commits into
accesslayerorg:devfrom
mayborn005:fix/issue-827
Open

feat: show 24h TWAP price on key detail page#852
mayborn005 wants to merge 5 commits into
accesslayerorg:devfrom
mayborn005:fix/issue-827

Conversation

@mayborn005

Copy link
Copy Markdown

Closes #827

Summary

Displays the 24-hour time-weighted average price alongside the spot price on the key detail page, so buyers have a less manipulable reference before purchasing.

Changes

  • src/services/course.service.tsgetKeyTwap(keyId, window='24h') calls GET /keys/:keyId/twap?window=24h.
  • src/hooks/useKeyTwap.ts — React Query hook (60s stale, no retry).
  • src/lib/queryKeys.tscreators.twap.
  • src/pages/CreatorDetailPage.tsx — renders the TWAP card with:
    • Label TWAP (24h) and an info tooltip ("Time-weighted average key price over the last 24 hours.").
    • Loading skeleton while fetching.
    • Green TWAP label/delta when the spot price is above TWAP, red when below.
    • The card is hidden entirely when the endpoint returns null/no price (insufficient data).

Notes

  • Uses the existing formatDisplayKeyPrice for display.
  • CI/lint: the code is JSX + hooks consistent with the existing page; please run the frontend lint/build in CI.

@mayborn005

Copy link
Copy Markdown
Author

✅ TWAP (24h) is now shown alongside the spot price with colour-coded comparison and a loading skeleton. @accesslayerorg this PR resolves issue #827.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a TWAP price display on the key detail page alongside the bonding curve spot price

3 participants