feat: implement real-time notifications and contract improvements#921
Merged
Olowodarey merged 5 commits intoJun 1, 2026
Merged
Conversation
- Add user-specific WebSocket notifications with batching and delivery confirmation - Implement platform statistics aggregation function in contract - Add comprehensive unit tests for oracle functions - Update notification service to broadcast via WebSocket - Add tests for platform statistics Closes Arena1X#762, Arena1X#821, Arena1X#827, Arena1X#828
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Emmy123222 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! 🚀 |
- Add user-specific WebSocket notifications with batching and delivery confirmation - Implement platform statistics aggregation function in contract - Add comprehensive unit tests for oracle functions - Update notification service to broadcast via WebSocket - Add tests for platform statistics Closes Arena1X#762, Arena1X#821, Arena1X#827, Arena1X#828
- Add user-specific WebSocket notifications with batching and delivery confirmation - Implement platform statistics aggregation function in contract - Add comprehensive unit tests for oracle functions - Update notification service to broadcast via WebSocket - Add tests for platform statistics Closes Arena1X#762, Arena1X#821, Arena1X#827, Arena1X#828
- Add user-specific WebSocket notifications with batching and delivery confirmation - Implement platform statistics aggregation function in contract - Add comprehensive unit tests for oracle functions - Update notification service to broadcast via WebSocket - Add tests for platform statistics Closes Arena1X#762, Arena1X#821, Arena1X#827, Arena1X#828
- Add user-specific WebSocket notifications with batching and delivery confirmation - Implement platform statistics aggregation function in contract - Add comprehensive unit tests for oracle functions - Update notification service to broadcast via WebSocket - Add tests for platform statistics Closes Arena1X#762, Arena1X#821, Arena1X#827, Arena1X#828
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.
Pull Request: Real-time Notifications & Contract Improvements
Closes #762, #821, #827, #828
Summary
This PR implements user-specific real-time notifications via WebSocket, adds platform statistics aggregation to the smart contract, and provides comprehensive unit tests for oracle and prediction functions.
Changes
Task 1: [Backend] User-specific Real-time Notifications (#762)
Implementation:
NotificationBroadcasterServicefor WebSocket notification deliverynotification:new→ new notification for usernotification:read→ notification marked as readprediction:result→ match result for user's predictionevent:winner→ user won an eventFiles Changed:
backend/src/websocket/notification-broadcaster.service.ts(new)backend/src/websocket/notification-broadcaster.service.spec.ts(new)backend/src/websocket/events.gateway.ts(updated)backend/src/websocket/websocket.module.ts(updated)backend/src/notifications/notifications.service.ts(updated)backend/src/notifications/notifications.module.ts(updated)Key Features:
user:{address}) for targeted deliveryTask 2: [Contract] Get Platform Statistics Function (#821)
Implementation:
get_platform_statisticsfunction toviews.rsFiles Changed:
contracts/creator-event-manager/src/views.rs(updated)contracts/creator-event-manager/src/lib.rs(updated)contracts/creator-event-manager/tests/views_tests.rs(updated)Data Structure:
Task 3: [Contract] Unit Tests for Oracle Functions (#828)
Implementation:
tests/oracle_tests.rssubmit_match_result:verify_event_winners:get_event_winners:get_user_score:Files Changed:
contracts/creator-event-manager/tests/oracle_tests.rs(new)contracts/creator-event-manager/tests/mod.rs(updated)Test Coverage:
Task 4: [Contract] Unit Tests for Prediction Functions (#827)
Status: ✅ Already implemented in existing codebase
The prediction tests were already comprehensive in
tests/prediction_tests.rs:join_eventtests (valid code, invalid code, already joined, full event, cancelled event)submit_predictiontests (valid, non-participant, late, invalid outcome, duplicate, cancelled event)get_predictiontests (returns correct data, non-existent error)get_user_predictionstests (returns all, sorted, empty list, multiple events)get_prediction_distributiontests (counts accurate, all outcomes included)Testing
Backend Tests
Test Results:
Contract Tests
Test Results:
API Changes
WebSocket Events (New)
Client → Server:
Server → Client:
Contract Functions (New)
Performance Considerations
Backend
Contract
Security Considerations
Backend
Contract
Migration Notes
Backend
No database migrations required. The changes are additive and backward-compatible.
Contract
No contract migration required. New functions are additive and don't modify existing state.
Documentation
Backend
Contract
Deployment Checklist
Future Improvements
Backend:
Contract:
Related Issues
Screenshots
N/A - Backend and contract changes only. Frontend integration will be handled in a separate PR.
Reviewers
@Arena1X/backend-team @Arena1X/contract-team
Additional Notes
All tasks have been completed successfully with comprehensive test coverage. The implementation follows existing patterns and maintains backward compatibility. No breaking changes introduced.