feat: batch syncStreams, status refresh cron, refresh token, claim flow (#136 #138 #140 #49)#190
Merged
ritik4ever merged 1 commit intoritik4ever:mainfrom Apr 25, 2026
Conversation
…ow (ritik4ever#136 ritik4ever#138 ritik4ever#140 ritik4ever#49) - ritik4ever#136: Replace sequential for-loop in syncStreams with p-limit concurrency (max 5 parallel RPC calls); falls back to sequential per-stream if the parallel pass throws; logs total sync time in ms on completion; adds p-limit to backend/package.json - ritik4ever#138: Wire refreshStreamStatuses to run on startup and every STATUS_REFRESH_INTERVAL_MS (default 60000ms); setting to 0 disables automatic refresh; logs count of streams transitioned to completed on each run; imports refreshStreamStatuses from streamStore in index.ts - ritik4ever#140: Add refreshToken() to auth.ts that verifies the current Bearer JWT and issues a new one with fresh 24h expiry; register POST /api/auth/refresh in index.ts; add Swagger docs entry with 200/401 response schemas - ritik4ever#49: Create frontend/src/services/soroban.ts with claimStream() that calls POST /api/streams/:id/claim; create frontend/src/hooks/useClaimStream.ts with idle/pending/confirmed/failed state machine, monotonic claim ID to prevent stale callbacks, 2s confirmed-label hold before reset; add backend POST /api/streams/:id/claim endpoint that validates recipient auth, checks claimable amount > 0, records claim event in DB, returns ClaimResult and event history
|
@benfoster-dev is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@benfoster-dev 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #136
Fixes #138
Fixes #140
Fixes #49
What changed
#136 — Batch
syncStreamswith concurrency limitbackend/src/services/streamStore.tsforloop withPromise.all+p-limit(5)— max 5 simultaneous RPC calls instead of N sequential callsp-limittobackend/package.json#138 — Configurable cron for
refreshStreamStatusesbackend/src/index.tsrefreshStreamStatuses()now runs once on startup and then everySTATUS_REFRESH_INTERVAL_MSms (default60000)STATUS_REFRESH_INTERVAL_MS=0disables automatic refresh (useful in test environments)refreshStreamStatusesto thestreamStoreimport#140 — Refresh token endpoint
backend/src/services/auth.tsrefreshToken(req, res)that verifies the current Bearer JWT and issues a new one with a fresh 24h expirybackend/src/index.tsPOST /api/auth/refreshbackend/src/swagger.ts/api/auth/refreshpath with 200 (new token) and 401 (invalid/expired) response schemas#49 — Claim flow for recipient dashboard
frontend/src/services/soroban.ts(new)claimStream(streamId, recipientAddress, amount)callsPOST /api/streams/:id/claimwith the recipient's Bearer token and returnsClaimResult + historyfrontend/src/hooks/useClaimStream.ts(new)idle → pending → confirmed/failed → idleclaimIdRefprevents stale async callbacks from mutating state after a superseded claimconfirmedstate so the "Claimed ✓" label is briefly visiblebackend/src/index.tsPOST /api/streams/:id/claimendpoint: validates the caller is the stream recipient, checksvestedAmount > 0, records aclaimedevent in the local DB, returns{ result: ClaimResult, history: StreamEvent[] }