Skip to content

feat(www): add Stellar testnet metrics counter with Soroban RPC#61

Open
Hollujay wants to merge 1 commit into
wraith-protocol:developfrom
Hollujay:feat/40-stellar-metrics-counter
Open

feat(www): add Stellar testnet metrics counter with Soroban RPC#61
Hollujay wants to merge 1 commit into
wraith-protocol:developfrom
Hollujay:feat/40-stellar-metrics-counter

Conversation

@Hollujay

Copy link
Copy Markdown
Contributor

Closes #40.

Summary

Adds a live-ish metrics counter section to the landing page that displays real stealth payment activity on the Stellar Soroban testnet. Pulls data directly from the announcer contract via Soroban RPC, showing counts for the last 24 hours, last 7 days, and all time.

Changes

New files

  • src/components/StellarMetrics.tsx — Counter component with three stat cards, data fetching, caching, and graceful empty/loading/error states.

Modified files

  • src/App.tsx — Imports and renders <StellarMetrics /> between the Chains and Compare sections.
  • package.json — Adds @wraith-protocol/sdk and @stellar/stellar-sdk as dependencies.

Details

Data source

Uses the Soroban JSON-RPC getEvents method on the Wraith announcer contract deployed on Stellar testnet. The latest ledger is obtained via the getLatestLedger RPC method, and ledger ranges are calculated assuming ~1 ledger per 5 seconds (17,280/day).

Time windows

Window Ledger range
Last 24 hours latestLedger - 17,280 → latest
Last 7 days latestLedger - 120,960 → latest
All time Ledger 1 → latest

Event filtering

Events are validated as announcements by checking event.topic.length >= 3 (matching the SDK's parseAnnouncementEvent guard). This ensures only valid stealth announcement events are counted, not unrelated contract events.

Caching

  • Strategy: Client-side in-memory Map with a 5-minute TTL.
  • Why: Prevents hammering the Soroban RPC on scroll/revisit while keeping infra minimal (no server-side cache).
  • Trade-off: Cache resets on page reload — acceptable for a landing page.

States handled

State Behaviour
Loading Animated pulse placeholders for each card
Error "—" and "Unable to fetch" in error color
Empty (0 count) "Just getting started" instead of "0"
Data Formatted count + "stealth payments processed on Stellar testnet"

Number formatting: raw values below 1,000, X.Xk below 1M, X.XM above.

Visual design

Matches the existing pattern from Features.tsxbg-surface-container cards with border-outline-variant, font-mono overline labels, font-heading count values, and scroll-triggered data-reveal entrance animations. Section header reads "Live Metrics" / "Stellar testnet activity."

Verification

  • npm run build passes (TypeScript + Vite + OG images)
  • npm test passes (6/6 tests, including a11y audit)
  • npm run format:check passes
  • No new warnings or errors introduced.

pull live stealth payment counts (24h, 7d, all-time) from announcer
contract events on Stellar Soroban testnet. use getLatestLedger RPC
method instead of error-message parsing, unified getEvents pagination
for all three windows, filter events by topic length, and graceful
empty state. includes client-side in-memory cache with 5-minute TTL
and inline cache strategy documentation.
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Hollujay is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Hollujay 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! 🚀

Learn more about application limits

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.

Stellar use-case metrics counter (testnet activity)

1 participant