feat(backend): wire top-up stream endpoint to Soroban contract (#415)#439
Conversation
|
hey, main was failing CI from broken auth imports + frontend parse errors. fixed and pushed to main now. please rebase to pick up the fixes: git fetch upstream
git rebase upstream/main
git push --force-with-leaseif there's a conflict, resolve it locally and we'll review once CI is green. |
6294720 to
8ef3f47
Compare
The CI is now green |
|
hey, since main now has #444 merged (the cancel stream endpoint), your branch is showing stale modifications to please rebase again to drop those: git fetch upstream
git rebase upstream/main
# during rebase, when conflicts appear in cancel.ts or sorobanService.ts:
git checkout upstream/main -- backend/src/controllers/stream/cancel.ts backend/src/services/sorobanService.ts
git add backend/src/controllers/stream/cancel.ts backend/src/services/sorobanService.ts
git rebase --continue
git push --force-with-leaseafter that, your diff should only show the actual feature for this PR and we can merge. |
4a03137 to
4e20dd3
Compare
I have dropped our copy of cancel.ts and sorobanService cancel logic in favour of main's version. The branch now only adds the top-up endpoint. CI is now green, please merge |
|
hey, main CI is fully green now. there were several real TypeScript and test issues from #444's merge that have all been fixed. please rebase one more time: git fetch upstream
git rebase upstream/main
git push --force-with-leaseyour PR's diff should be much cleaner after this rebase since main now has the canonical versions of cancel.ts, sorobanService.ts, and the withdraw test. |
ogazboiz
left a comment
There was a problem hiding this comment.
hey @cybermax4200, the top-up endpoint implementation looks solid:
- Zod validation on body
- Sender-only authorization check
- Updates depositedAmount in DB
- Returns txHash properly
but there's a lot of scope creep in this PR — the title is "wire top-up stream endpoint" but it also includes:
backend/cp— empty stray file being deleted. fine to keep but confirms there was build noise.backend/src/controllers/user.controller.ts— adds pagination togetUserEvents. nice improvement but unrelated to top-up.backend/src/middleware/stream-rate-limiter.middleware.ts— removesipKeyGeneratorimport. unrelated.frontend/src/components/NotificationDropdown.tsx— frontend change in a backend PR.backend/tests/claimable.service.test.tsandbackend/tests/stream.test.ts— modifications to existing tests.
would you split out the unrelated changes (user.controller pagination, NotificationDropdown, rate limiter) into separate PRs? this PR should ideally only contain:
- top-up endpoint implementation
- top-up integration tests
- the route wiring in stream.routes.ts
once the diff is scoped to just top-up, this is good to merge. the actual top-up code is fine.
57de3d6 to
2607353
Compare
a5f3c8b to
ac3abe8
Compare
it has been taken care of |
ogazboiz
left a comment
There was a problem hiding this comment.
hey @cybermax4200, scope is much tighter now. top-up handler, top-up service function, route wiring, integration tests — exactly what closes #415. the small leftover changes (rate limiter import cleanup, comment fixes) are tiny and harmless. all CI green. merging!
if you want to keep contributing or follow up on open issues, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0
|
Thank you for the issues, I believe we will work more closely next wave |
Closes #415
Changes
backend/src/services/sorobanService.ts
topUpStream(streamId, amount, callerAddress)— builds, simulates,signs with KEEPER_SECRET_KEY, submits
top_up_streamcontract call,returns txHash
backend/src/controllers/stream.controller.ts
topUpStreamHandleramountas positive integer string (XLM stroops) → 400 on failuretopUpStream(); updatesdepositedAmount+lastUpdateTimein DB on successbackend/src/routes/v1/stream.routes.ts
POST /:streamId/top-upbehindauthMiddlewarebackend/tests/integration/top-up.test.ts
404 stream not found, 403 wrong caller, DB update assertion
Env var required
KEEPER_SECRET_KEY— Stellar secret key used to sign the contract transaction