Skip to content

feat: implement wallet balance API endpoint#264

Merged
Emrys02 merged 1 commit into
zendvolabs:mainfrom
MerlinTheWhiz:feat/wallet-balance-api
Jun 1, 2026
Merged

feat: implement wallet balance API endpoint#264
Emrys02 merged 1 commit into
zendvolabs:mainfrom
MerlinTheWhiz:feat/wallet-balance-api

Conversation

@MerlinTheWhiz

Copy link
Copy Markdown
Contributor

Closes #253

Changes made:

  1. src/proxy.ts:24 — Added "/api/wallet" to PROTECTED_API_ROUTES so the middleware injects x-user-id header (and handles token refresh/fingerprint validation).
  2. src/app/api/wallet/balance/route.ts — New GET endpoint that:
  • Authenticates via x-user-id header
  • Supports optional ?currency=NGN query filter
  • Returns per-currency wallet data with:
    Field Description
    balance Raw wallet balance
    pendingWithdrawals Sum of gifts in confirmed status where user is sender (committed but not yet debited)
    lockedBalance Sum of gifts received (completed/sent status) with unlockDatetime in the future
    availableBalance balance - pendingWithdrawals - lockedBalance (floor 0)
    Example response:
    { "success": true, "data": { "wallets": [ { "id": "...", "currency": "NGN", "balance": 100000, "availableBalance": 95000, "pendingWithdrawals": 5000, "lockedBalance": 0 } ] } }

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

@MerlinTheWhiz is attempting to deploy a commit to the lewechifavour466-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented May 31, 2026

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

🚀 Done Verification Checklist

  • Problem & Impact: Does the description clearly state the problem and the impact of the fix?
  • Issue Linked: Does the PR description include Closes #XXX?
  • Tests: Have you added/updated tests?
  • UI Screenshots: If this is a frontend change, have you attached screenshots or a video?
  • Code Quality: Does the code follow the [Zendvo Five Principles]?

This is an automated reminder to ensure high-quality contributions.

@Emrys02 Emrys02 merged commit 9588add into zendvolabs:main Jun 1, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetch Wallet Balance API

2 participants