Skip to content

Implements four backend realtime/withdrawals issues on test-implement-drips. - #1121

Merged
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
JONAH-6:feat/realtime-leaderboard-redis-withdrawal-submit-940-948-949-952
Jul 26, 2026
Merged

Implements four backend realtime/withdrawals issues on test-implement-drips.#1121
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
JONAH-6:feat/realtime-leaderboard-redis-withdrawal-submit-940-948-949-952

Conversation

@JONAH-6

@JONAH-6 JONAH-6 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Branch feat/realtime-leaderboard-redis-withdrawal-submit-940-948-949-952 (off
test-implement-drips) resolves all 4 issues:

  • Realtime: Emit leaderboard.updated events #952 — Added leaderboard.updated socket event, broadcast to a public leaderboard
    room whenever a confirmed tip changes a creator's rank (wired into the existing
    tip-confirmation flow, best-effort like the existing balance.updated).
  • Realtime: Redis adapter for horizontal scaling #948 — Attached the Socket.IO Redis adapter (@socket.io/redis-adapter, using two
    duplicated ioredis connections) so rooms are shared across horizontally scaled
    instances. Gated by a new REALTIME_REDIS_ADAPTER_ENABLED env var (default true;
    disabled in tests).
  • Realtime: Per-creator rooms #949 — The per-creator room implementation already existed from earlier work;
    added stronger tests proving targeted delivery (not just "no error thrown").
  • Withdrawals: POST /withdrawals/submit (signed tx) #940 — Added POST /withdrawals/submit: broadcasts a wallet-signed transaction via
    Soroban RPC and records a PENDING withdrawal, idempotent by txHash.

Also fixed a pre-existing bug in tips.test.ts (an undefined mockCreateNotification
reference and a mockUserFindUnique typo) that was crashing the entire test file
before any test in it could run — necessary to verify my own change and to unblock
the suite.

Verified: npm run typecheck and npm run lint are clean of anything I touched (only a
pre-existing, unrelated credit.service.ts bug remains). npm run test — my new/fixed
tests all pass (21 new tests + 37 recovered tests); no regressions versus baseline.

PR body to use

Implements four backend realtime/withdrawals issues on test-implement-drips.

What's done

  • Leaderboard realtime events: leaderboard.updated is emitted to a public
    leaderboard room whenever a confirmed tip changes a creator's rank. Clients
    subscribe with subscribe:leaderboard / unsubscribe:leaderboard.
  • Redis adapter for horizontal scaling: initRealtime attaches
    @socket.io/redis-adapter (two duplicated ioredis connections) so rooms
    are shared across multiple backend instances. Controlled by
    REALTIME_REDIS_ADAPTER_ENABLED (new env var, documented in .env.example
    and src/config/env.ts; defaults to true, disabled in the test suite).
  • Per-creator rooms: implementation already existed; added test coverage
    proving tip.created-style events are only delivered to sockets that
    subscribed to that creator's room.
  • POST /withdrawals/submit: accepts a wallet-signed transaction XDR,
    broadcasts it via Soroban RPC, and records a PENDING withdrawal row
    (idempotent by txHash). Validated with Zod; errors use AppError.

Also fixed

  • tips.test.ts had a pre-existing bug (undefined mockCreateNotification,
    a mockUserFindUnique typo) that crashed the entire file before any test
    could run. Fixed so the suite — and the new leaderboard test in it — can
    actually execute.

Testing

  • npm run typecheck — clean (no new errors)
  • npm run lint — clean (no new warnings/errors)
  • npm run test — all new/fixed tests pass; no regressions

Closes #952
Closes #948
Closes #949
Closes #940

…thdrawal submit endpoint

Implements four backend issues on test-implement-drips:

- Realtime: emit leaderboard.updated to a public `leaderboard` room whenever
  a confirmed tip changes a creator's rank (Akanimoh12#952).
- Realtime: attach the Socket.IO Redis adapter (gated by
  REALTIME_REDIS_ADAPTER_ENABLED) so rooms are shared across horizontally
  scaled instances (Akanimoh12#948).
- Realtime: strengthen per-creator room test coverage with targeted-delivery
  assertions; the room join/auth implementation already existed (Akanimoh12#949).
- Withdrawals: add POST /withdrawals/submit to broadcast a wallet-signed
  withdrawal transaction and record it as a PENDING withdrawal, idempotent
  by txHash (Akanimoh12#940).

Also fixes a pre-existing bug in tips.test.ts (undefined mockCreateNotification
reference / mockUserFindUnique typo) that was crashing the entire test file
before any test could run.

Closes Akanimoh12#952
Closes Akanimoh12#948
Closes Akanimoh12#949
Closes Akanimoh12#940

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@JONAH-6 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

@Akanimoh12

Copy link
Copy Markdown
Owner

Great work

@Akanimoh12
Akanimoh12 merged commit 21c641e into Akanimoh12:test-implement-drips Jul 26, 2026
4 of 5 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

2 participants