Feature/overflow protection and dashboard improvements#254
Merged
ogazboiz merged 7 commits intoApr 28, 2026
Merged
Conversation
…lation - Replace unwrap_or(i128::MAX) with explicit overflow handling in calculate_claimable - Use checked_mul for rate_per_second * elapsed_seconds multiplication - Cap at deposited_amount when overflow would occur - Use checked_sub for deposited - withdrawn calculation - Add unit test test_claimable_max_i128_rate_overflow - Document overflow boundary in code comments
- Create useStreamEvents hook for SSE subscription - Support filtering by stream IDs and user public keys - Auto-reconnect with exponential backoff - Handle event types: created, topped_up, withdrawn, cancelled, completed - Keep last 100 events in memory
- Import and use useStreamEvents hook in dashboard-view - Subscribe to events for connected wallet public key - Refresh dashboard data when SSE events arrive - Handle created, topped_up, withdrawn, cancelled, completed events
…actions - Convert from mock data to real API data fetching - Add withdraw action with Freighter wallet integration - Add top-up action with amount input - Add cancel action with confirmation - Display full stream info: sender, recipient, token, rate, dates - Show live claimable balance counter - Show progress bar with withdrawn/total - Add loading and error states - Note: Stream creation form already has Freighter integration in dashboard-view
- Fix useStreamEvents lint errors by removing explicit any and avoiding connect self-reference - Remove unused sseConnected destructure in dashboard-view - Remove unused Transaction type from stream detail page - Update PR test gate workflow to install Rollup Linux native binding (npm optional deps bug workaround)
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.
Fix Overflow Protection and Dashboard Improvements
closes #236
closes #237
closes #238
closes #239
Summary
This PR addresses issues #236, #237, #238, and #239 by adding overflow protection to the smart contract, integrating SSE for real-time dashboard updates, and implementing the stream detail page with full functionality.
Changes
Issue #236: Overflow Protection in Smart Contract
Files Modified:
contracts/stream_contract/src/lib.rscontracts/stream_contract/src/test.rsChanges:
unwrap_or(i128::MAX)with explicit overflow handling incalculate_claimablechecked_mulforrate_per_second * elapsed_secondsmultiplicationdeposited_amountwhen overflow would occurchecked_subfordeposited - withdrawncalculationtest_claimable_max_i128_rate_overflowto verify overflow protectionImpact: Prevents integer overflow in claimable amount calculations, ensuring no overflow for any valid input.
Issue #237: Stream Creation Form with Freighter Integration
Status: Already implemented in
frontend/components/dashboard/dashboard-view.tsxThe stream creation form already has Freighter wallet integration through the
handleCreateStreamfunction which callssorobanCreateStreamfromlib/soroban.ts. The integration includes:signTransactionIssue #238: Real-Time Stream Dashboard with SSE Integration
Files Modified:
frontend/hooks/useStreamEvents.ts(new file)frontend/components/dashboard/dashboard-view.tsxChanges:
useStreamEventsReact hook for SSE subscriptioncreated,topped_up,withdrawn,cancelled,completedImpact: Users can now see live updates to their streams without refreshing the page.
Issue #239: Stream Detail Page with Actions
Files Modified:
frontend/app/streams/[id]/page.tsxChanges:
Impact: Users can now view detailed stream information and perform actions (withdraw, top-up, cancel) directly from the stream detail page.
Testing
Contract Tests
test_claimable_max_i128_rate_overflowto verify overflow protectionFrontend Testing
lib/soroban.tsBreaking Changes
None. All changes are backward compatible.
Checklist