Skip to content

Draft: Feature/new_rpc_methods#5

Open
leinss wants to merge 5 commits into
devfrom
feature/new_rpc_methods
Open

Draft: Feature/new_rpc_methods#5
leinss wants to merge 5 commits into
devfrom
feature/new_rpc_methods

Conversation

@leinss

@leinss leinss commented Dec 15, 2025

Copy link
Copy Markdown

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:

  • Introduced a new InvitationWithProfile type (with InvitationSource) to represent all invitation types and updated all components, context, and props to use this unified format instead of the old AvatarWithProfile type. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Added logic to handle both legacy and new invitation data formats, including a helper to fetch and merge profile data for all invitation sources.
  • Enhanced the UI to display the source of each invitation (trust, escrow, referral) with badges and relevant details (e.g., escrow amount, days, balance) in the GetInvited and MigrationOverview components. [1] [2] [3]
  • Added mock invitation data and a toggle (USE_MOCK_INVITATIONS) to enable UI testing with all invitation types. [1] [2] [3]

Network Configuration Updates:

  • Updated all relevant URLs for the Circles staging environment, including circlesRpcUrl, profileServiceUrl, and SDK runner endpoints. [1] [2] [3]

Build Tooling:

  • Upgraded the vite development dependency from version 5.2.11 to 7.2.7 in package.json.

@coderabbitai

coderabbitai Bot commented Dec 15, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/new_rpc_methods

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leinss leinss requested a review from Copilot December 15, 2025 07:44
@leinss leinss changed the title Feature/new_rpc_methods Draft: Feature/new_rpc_methods Dec 15, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 InvitationWithProfile type 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.

Comment thread src/context/CirclesContext.tsx Outdated
};

// Set to true to test UI with mock invitation data (all 3 types)
const USE_MOCK_INVITATIONS = true;

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
const USE_MOCK_INVITATIONS = true;
const USE_MOCK_INVITATIONS = false;

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +81
(circlesSdkRunner.data as any).getAllInvitations
? (circlesSdkRunner.data as any).getAllInvitations(address)
: circlesSdkRunner.data.getInvitations(address)

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
};

// Fetch invitation profiles - handles both old (AvatarRow[]) and new (AllInvitationsResponse) formats
const fetchInvitationProfiles = async (invitationsData: any, circlesSdkRunner: Sdk): Promise<InvitationWithProfile[]> => {

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@leinss leinss force-pushed the feature/new_rpc_methods branch from 8306b62 to 22e708e Compare December 15, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants