Draft: Feature/new_rpc_methods#5
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR implements support for new RPC methods to handle multiple invitation types in the Circles protocol. The changes introduce a unified InvitationWithProfile type that supports three invitation sources (trust-based, escrow, and at-scale/referral), adapting the UI and data fetching logic to accommodate these different invitation types while maintaining backward compatibility with the existing API.
Key Changes
- Added new
InvitationWithProfiletype that unifies three invitation sources with source-specific optional fields - Updated RPC endpoint from production (
rpc.circlesubi.network) to staging (staging.circlesubi.network) across all configuration files - Enhanced UI components to display invitation source badges and source-specific details (balance, escrow amount, referral status)
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/test/mockInvitations.ts |
New file with mock invitation data for testing all three invitation types |
src/context/CirclesContext.tsx |
Major refactoring: added InvitationWithProfile type, fetchInvitationProfiles function with format detection, and mock data flag |
src/flow/steps.ts |
Updated type reference from AvatarWithProfile[] to InvitationWithProfile[] |
src/components/GetInvited.tsx |
Enhanced to display source badges and source-specific invitation details with formatting utilities |
src/components/MigrationOverview.tsx |
Updated to show invitation source labels and adjusted to use address field instead of avatar.avatar |
src/components/MigrationFlow.tsx |
Type signature update to use InvitationWithProfile[] |
src/components/CirclesOverview.tsx |
Type signature update to use InvitationWithProfile[] |
src/constants/networks.ts |
Changed RPC URLs from production to staging environment |
src/context/WalletContext.tsx |
Changed RPC URLs from production to staging environment |
package.json |
Upgraded Vite from ^5.2.11 to ^7.2.7 |
package-lock.json |
Dependency tree updates for Vite 7.x and related packages |
README.md |
Minor whitespace change (no functional impact) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
|
|
||
| // Set to true to test UI with mock invitation data (all 3 types) | ||
| const USE_MOCK_INVITATIONS = true; |
There was a problem hiding this comment.
The USE_MOCK_INVITATIONS flag is set to true, which means the application will use mock invitation data instead of real data from the API. This should be set to false before deploying to production or merging to main. The mock data is intended for testing UI with all 3 invitation types during development only.
| const USE_MOCK_INVITATIONS = true; | |
| const USE_MOCK_INVITATIONS = false; |
| (circlesSdkRunner.data as any).getAllInvitations | ||
| ? (circlesSdkRunner.data as any).getAllInvitations(address) | ||
| : circlesSdkRunner.data.getInvitations(address) |
There was a problem hiding this comment.
The type casting to any bypasses TypeScript's type safety. Consider adding proper type definitions for the getAllInvitations method or creating a type guard to check if the method exists. This would prevent potential runtime errors if the method signature changes.
| }; | ||
|
|
||
| // Fetch invitation profiles - handles both old (AvatarRow[]) and new (AllInvitationsResponse) formats | ||
| const fetchInvitationProfiles = async (invitationsData: any, circlesSdkRunner: Sdk): Promise<InvitationWithProfile[]> => { |
There was a problem hiding this comment.
The fetchInvitationProfiles function uses any type for invitationsData parameter, which defeats TypeScript's type checking. Consider defining a union type for the expected formats (e.g., AvatarRow[] | AllInvitationsResponse) to make the code more type-safe and self-documenting.
8306b62 to
22e708e
Compare
This pull request introduces a unified invitation system to support multiple invitation types (trust, escrow, and at-scale/referral) throughout the Circles migration UI. The changes refactor data structures, update component interfaces, and enhance the user interface to clearly display invitation sources and relevant details. Additionally, the pull request updates staging network URLs and adds mock data support for easier UI testing.
Unified Invitation System and UI Enhancements:
InvitationWithProfiletype (withInvitationSource) to represent all invitation types and updated all components, context, and props to use this unified format instead of the oldAvatarWithProfiletype. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]GetInvitedandMigrationOverviewcomponents. [1] [2] [3]USE_MOCK_INVITATIONS) to enable UI testing with all invitation types. [1] [2] [3]Network Configuration Updates:
circlesRpcUrl,profileServiceUrl, and SDK runner endpoints. [1] [2] [3]Build Tooling:
vitedevelopment dependency from version 5.2.11 to 7.2.7 inpackage.json.