Skip to content

feat: complete select-winners API and align wallet APIs with Stellar sync model#288

Merged
3m1n3nc3 merged 2 commits intogeevapp:mainfrom
boys-cyberhub:feat/issues-280-283-winners-wallet
Apr 25, 2026
Merged

feat: complete select-winners API and align wallet APIs with Stellar sync model#288
3m1n3nc3 merged 2 commits intogeevapp:mainfrom
boys-cyberhub:feat/issues-280-283-winners-wallet

Conversation

@boys-cyberhub
Copy link
Copy Markdown
Contributor

Closes #280
Closes #283

What changed

#280 — Complete select-winners API

  • Strict per-method schemas via zod discriminated union — each method gets its own validated shape
  • random — Fisher-Yates shuffle, respects count param, capped at maxWinners
  • manual — accepts only entryIds (UUID array); validates all IDs belong to the post; rejects unknown IDs with clear error; deduplicates; caps at maxWinners
  • merit_based — ranks eligible entries by burn count desc, entry age asc as tiebreaker
  • firstcome — selects earliest count entries (already ordered by createdAt asc)
  • Duplicate prevention — existing winners are excluded from eligible pool before selection
  • Consistent post status + notifications — single $transaction marks entries isWinner, upserts PostWinner rows, sets post status: completed, and creates giveaway_win notifications for each winner

#283 — Align wallet APIs with Stellar sync model

  • GET /api/wallet/balance — normalized response: { balance, assets, transactions, lastSync, simulated }; ?simulated=false placeholder for future on-chain Stellar asset fetch
  • POST /api/wallet/fund — accepts simulated flag (default true); simulated=false returns 501 stub for on-chain path; response includes lastSync
  • POST /api/wallet/withdraw — same simulated flag pattern; response includes lastSync
  • GET /api/wallet/transactions — adds lastSync field so clients can implement interval/focus refresh without blind polling

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 23, 2026

@boys-cyberhub 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

Copy link
Copy Markdown
Contributor

@3m1n3nc3 3m1n3nc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts

- Keep our strict per-method Zod schemas and all 4 selection modes
- Add upstream's checkAndAwardBadges call (async, best-effort) after winner selection
- Preserve our rich response shape (method, postId, postStatus, totalSelected, winners)
@Uchechukwu-Ekezie
Copy link
Copy Markdown

please review

@3m1n3nc3 3m1n3nc3 merged commit 1915a03 into geevapp:main Apr 25, 2026
2 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.

Align wallet APIs with Stellar sync model and client refresh policy Complete select-winners API for all supported methods

3 participants