Serve wallet level history in profile modal via indexer #336
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#336
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Gap analysis follow-up from #331.
Current codebase
LevelUpandFeatureUnlockedevents:idx_arena_level_up(player, new_level, block_timestamp) —indexer/migrations/20260613120000_idx_arena_timearena_events_gl317.up.sqlidx_arena_feature_unlocked(player, feature_level, block_timestamp)indexer/src/persist.rs·DecodedEvent::ArenaLevelUp,ArenaFeatureUnlockedGET /v1/arena/wallet/{address}/stats(indexer/src/arena_wallet_stats.rs) returns currentlevel,xp,first_buy_atbut no level milestone history.WalletProfileModal+WalletProfileModalSections.tsxshow balances, stats, prizes, scores — opened from play/AUDIT on participant click (#258).formatWalletProfileUnixSecexists for local-time display.Why needed
Approved: store UTC timestamps for each wallet's progression milestones and surface Level History in the existing account/profile modal — Level 1 = first buy time; Levels 2–5 =
LevelUpevent times; display in local time.Constraints / guardrails
idx_arena_buy/ existingfirst_buy_aton wallet stats) unless a dedicated first-buy event is more accurate.idx_arena_level_uprow pernew_levelfor that player (handle reorg/idempotency via existing persist keys).GET /v1/arena/wallet/{address}/level-history— bump schema version if shape changes.Relevant files
indexer/migrations/20260613120000_idx_arena_timearena_events_gl317.up.sqlindexer/src/persist.rsindexer/src/arena_wallet_stats.rsindexer/src/api_arena.rsindexer/tests/integration_stage2.rsfrontend/src/components/WalletProfileModal.tsx,WalletProfileModalSections.tsxfrontend/src/lib/indexerApi.ts·ArenaWalletStatsfrontend/src/lib/walletProfileFormat.tsRecommended direction
level_history: [{ level: "1", reached_at: "<iso8601>" }, …]to wallet stats response (levels 1–5; null when unknown).MIN(block_timestamp)from first buy for player.MIN(block_timestamp)fromidx_arena_level_up WHERE new_level = N.WalletProfileLevelHistorySection— heading "Level history", rows 1–5 with local datetime + short label (reuse progression tier labels).WalletProfileModalwhen stats loaded (not balances-only layout).Acceptance criteria
cd indexer && cargo clippy --all-targets -- -D warnings && cargo testpasses.cd frontend && npm run typecheck && npm run lint && npm testpasses.Test plan
cd indexer && cargo testarena_wallet_stats.rsunit tests +integration_stage2.rsYIELDOMEGA_PG_TEST_URL=... cargo test --test integration_stage2 arena_wallet_statscd frontend && npm testWalletProfileModalSections.test.tsxbash scripts/verify-wallet-profile-anvil.shHappy path: wallet with buy + L2 level-up. Sad path: wallet never bought → empty history; malformed address → 400.
Attack / abuse test plan
Verification criteria
curlwallet stats for Anvil buyer showslevel_historyentries after scripted buys.mentioned in issue #331
mentioned in merge request !509
mentioned in commit
8452c43484mentioned in commit
5b3bf97e59mentioned in merge request !512
mentioned in commit
e60a100f0amentioned in merge request !514
mentioned in issue #339
mentioned in merge request !515
mentioned in issue #340
mentioned in issue #342
mentioned in issue #343