Skip to content

feat(api): add GET /accounts/{address}/positions - #141

Merged
JiahuiWho merged 17 commits into
main-blendfrom
feat/blend-positions-api-3
Aug 1, 2026
Merged

feat(api): add GET /accounts/{address}/positions#141
JiahuiWho merged 17 commits into
main-blendfrom
feat/blend-positions-api-3

Conversation

@JiahuiWho

Copy link
Copy Markdown

Maps wallet-backend Blend positions into the frontend-shaped response: one payload serves Position Home (header + pool rows) and Position Details (per-asset supply/borrow rows).

  • Mapper: fully-exited (all-zero) reserve rows are filtered from display lists (upstream emits them for earnings history); supply rows combine plain-supply and collateral portions while preserving the split; interest_earned_usd converts the token-denominated lifetime interest at today's oracle price (null when price/decimals unavailable, never a fabricated zero).
  • Account header: total = sum of pool net values with strict null propagation; net APY = net-value-weighted mean of pool net APYs. Both rules are isolated in accountAggregate() pending upstream confirmation.
  • Redis cache per (network, address), TTL from BlendConfig (default 30s); cache reads fail open, cache errors never fail the request.
  • Handler follows house patterns: network + strkey validation, 10s timeout, translateServiceError mapping (upstream errors -> 502), empty

Comment thread internal/services/positions.go
Comment thread internal/services/positions.go Outdated
Comment thread internal/services/positions.go Outdated
Base automatically changed from feat/blend-positions-api-2 to main-blend August 1, 2026 01:14
@JiahuiWho
JiahuiWho merged commit 85395e0 into main-blend Aug 1, 2026
9 of 10 checks passed
@JiahuiWho
JiahuiWho deleted the feat/blend-positions-api-3 branch August 1, 2026 01:25
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.

2 participants