Skip to content

feat(data): Soroban RPC service layer, price feeds, and TVL/APY hooks#66

Merged
wumibals merged 2 commits into
LadderMine:mainfrom
devwums:feat/data-service-layer-44
Jun 25, 2026
Merged

feat(data): Soroban RPC service layer, price feeds, and TVL/APY hooks#66
wumibals merged 2 commits into
LadderMine:mainfrom
devwums:feat/data-service-layer-44

Conversation

@devwums

@devwums devwums commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Builds the data service layer connecting the frontend to live on-chain Soroban data, unblocking the dashboard, deposit, and analytics pages.

New files

services/rpc.ts - Soroban JSON-RPC client using native fetch; reads NEXT_PUBLIC_SOROBAN_RPC_URL env var

services/prices.ts - Fetches XLM and EURC prices from Stellar Horizon DEX order book API; 60s in-memory cache; exports fetchAssetPrices() and useAssetPrices() hook

hooks/usePosition.ts - Reads user shares, principal, accrued yield, and lock expiry per vault tier

hooks/useAllocations.ts - Reads AMM pool allocations from StrategyVault contract; polls every 30s

hooks/useTVL.ts - Reads total_shares from each vault and reverses the share multiplier (Flex 1.00x, L3 1.05x, L6 1.15x, L12 1.35x) to produce per-tier and aggregate TVL in USDC

hooks/useAPY.ts - Fetches harvest events from Harvester contract, sums yield over trailing 7d and 30d windows, annualises

components/StatsBar.tsx - Client component wiring useTVL and useAPY into a live stats bar

Updated files

app/page.tsx - Replaces the static placeholder with StatsBar showing live TVL, vault count, and best 7d APY

Notes

closes #44

…ooks

- Add services/rpc.ts: singleton Soroban JSON-RPC client using native fetch, reads NEXT_PUBLIC_SOROBAN_RPC_URL env var
- Add services/prices.ts: fetches XLM and EURC prices from Stellar Horizon DEX order book with 60s in-memory cache; exports fetchAssetPrices() and useAssetPrices() hook
- Add hooks/usePosition.ts: reads user position (shares, principal, accruedYield, lockUntil) per vault tier with loading/error states
- Add hooks/useAllocations.ts: reads AMM pool allocations from StrategyVault contract with 30s polling
- Add hooks/useTVL.ts: aggregates per-tier TVL by reading total_shares from each vault and reversing the share multiplier (Flex=1.00x, L3=1.05x, L6=1.15x, L12=1.35x)
- Add hooks/useAPY.ts: calculates trailing 7d and 30d APY from Harvester contract events, annualised
- Add components/StatsBar.tsx: client component wiring useTVL and useAPY into a live stats bar
- Update app/page.tsx: replace static placeholder with StatsBar showing live TVL, vault count, and best 7d APY
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

@devwums is attempting to deploy a commit to the wumibals' projects Team on Vercel.

A member of the Team first needs to authorize it.

@wumibals wumibals merged commit 78cda00 into LadderMine:main Jun 25, 2026
1 of 4 checks passed
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.

[GF-12] [FRONTEND] Data Service Layer (Soroban RPC hooks, price feeds, TVL/APY)

2 participants