Skip to content

feat(analytics): add TVL endpoint for pending stakes aggregation#123

Merged
PeterOche merged 2 commits intodegenspot:mainfrom
phertyameen:totalValueLocked
Mar 24, 2026
Merged

feat(analytics): add TVL endpoint for pending stakes aggregation#123
PeterOche merged 2 commits intodegenspot:mainfrom
phertyameen:totalValueLocked

Conversation

@phertyameen
Copy link
Copy Markdown
Contributor

Summary

Adds a new endpoint that aggregates a user's active Portfolio Total Value
Locked (TVL) by summing all stakes where the underlying call is still PENDING.

Endpoint

GET /analytics/:userAddress/tvl

Changes

  • dto/tvl.dto.ts new TotalValueLockedResponseDto with totalValueLocked,
    pendingStakesCount, and userAddress fields
  • analytics.service.ts new getTotalValueLocked() method using a TypeORM
    QueryBuilder aggregate query joined on the Call relation
  • analytics.controller.ts new GET endpoint with full Swagger documentation
  • analytics.service.tvl.spec.ts unit tests covering happy path, zero stakes,
    and null DB response edge case

Testing

  • Unit tests pass (npm run test)
  • Swagger UI reflects new endpoint
  • Manually verified with a wallet address that has pending stakes

Closes #116

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@phertyameen 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

@PeterOche PeterOche merged commit 121687b into degenspot:main Mar 24, 2026
3 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.

User Portfolio TVL Aggregator

2 participants