Replace mock leaderboard with live Soroban RPC / indexer query (Closes #20)#62
Open
storm-beyndtech wants to merge 1 commit into
Open
Replace mock leaderboard with live Soroban RPC / indexer query (Closes #20)#62storm-beyndtech wants to merge 1 commit into
storm-beyndtech wants to merge 1 commit into
Conversation
…pLabs#20) - soroban.ts: add SorobanService.getLeaderboard(offset, limit, sortKey) returning { entries, total } from either the backend indexer (NEXT_PUBLIC_LEADERBOARD_API_URL) or an on-chain event scan over lock_assets / unlock_assets / update_credits across the factory pools and NEXT_PUBLIC_POOL_CONTRACT_ID, mirroring getPoolDepositors. - useLeaderboard.ts: drop the synthetic rows; fetch only the current page, server-side sort, 30s current-page refresh, 300ms debounced address filter. - Leaderboard page unchanged (same hook interface).
f0f6b12 to
0828c1c
Compare
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.
What
Replaces the 100 synthetic leaderboard rows with a live data source.
SorobanService.getLeaderboard(offset, limit, sortKey)returns one{ entries, total }page from either:NEXT_PUBLIC_LEADERBOARD_API_URL(?offset&limit&sort),the intended source once
smartdrop-backend/api/v1/leaderboardships.lock_assets/unlock_assets/update_creditsacross the factory pools andNEXT_PUBLIC_POOL_CONTRACT_ID, mirroring the existinggetPoolDepositorspattern. Best-effort over a ~7‑day lookback until the backend exists.
useLeaderboardnow fetches only the current page (server-side sort), keeps the30s refresh scoped to that page, and debounces the address filter at 300ms.
Acceptance criteria
PAGE_SIZE = 10, offset/limit)Files
src/lib/soroban.tssrc/hooks/useLeaderboard.tsNotes for reviewers
tsc) for both changed files.maincurrently has pre-existing build-breaking corruption unrelated tothis PR —
next.config.ts:4,src/app/farm/page.tsx:3, andConnectWalletButton.tsxcontain injected/garbled lines (see separate report).A red
next buildin CI stems from that, not from this change.