Skip to content

refactor(governance/xc_admin_frontend): refactor xc_admin_frontend to support lazer and other programs #2660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
May 19, 2025

Conversation

cctdaniel
Copy link
Contributor

@cctdaniel cctdaniel commented May 7, 2025

Summary

This PR introduces a modular architecture for supporting multiple Pyth programs (Pyth Core and Pyth Lazer) in our frontend application. Key changes include:

  1. Added an extensible adapter pattern with ProgramAdapter interface and program-specific implementations
  2. Created a ProgramType enum to differentiate between Pyth Core and Pyth Lazer
  3. Implemented UI components for program selection and program-specific views
  4. Added context providers to manage program state across the application
  5. Refactored existing code to use the new adapter-based architecture
  6. Eliminated code duplication by leveraging shared components

Rationale

These changes were necessary to:

  1. Support the upcoming Pyth Lazer program alongside the existing Pyth Core program
  2. Isolate program-specific logic into separate modules for better maintainability
  3. Allow for easier integration of additional Pyth programs in the future
  4. Provide a clean, intuitive UI for users to switch between different programs
  5. Reduce code duplication through a common interface for all program interactions
  6. Make the codebase more maintainable by ensuring program-specific changes only need to be made in isolated locations

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Tested by:

  • Verifying program switching works correctly in the UI
  • Confirming Pyth Core functionality remains intact with the new architecture
  • Ensuring Pyth Lazer placeholder components display correctly
  • Checking that all UI components adapt appropriately to the selected program
  • Validating that the adapter pattern correctly redirects requests to the appropriate program implementation
  • Confirming program context state persists across page navigation

Copy link

vercel bot commented May 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
proposals ✅ Ready (Inspect) Visit Preview 1 resolved May 19, 2025 5:35am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Skipped (Inspect) May 19, 2025 5:35am
component-library ⬜️ Skipped (Inspect) May 19, 2025 5:35am
entropy-debugger ⬜️ Skipped (Inspect) May 19, 2025 5:35am
entropy-explorer ⬜️ Skipped (Inspect) May 19, 2025 5:35am
insights ⬜️ Skipped (Inspect) May 19, 2025 5:35am
staking ⬜️ Skipped (Inspect) May 19, 2025 5:35am

Copy link
Collaborator

@cprussin cprussin left a comment

Choose a reason for hiding this comment

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

Definitely getting a lot closer, but still a few things to fix. The most important things to me are to avoid using any as much as possible (still a few places here that introduce it) and to avoid creating components in the render path of other componets.

I realize that a lot of this stuff was just moved around and isn't actually new code, so maybe it's best to leave the things that aren't net new alone and get this shipped, and to create a follow up PR to fix those patterns?

@vercel vercel bot temporarily deployed to Preview – api-reference May 19, 2025 05:26 Inactive
@vercel vercel bot temporarily deployed to Preview – insights May 19, 2025 05:26 Inactive
@vercel vercel bot temporarily deployed to Preview – staking May 19, 2025 05:26 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger May 19, 2025 05:26 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer May 19, 2025 05:27 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library May 19, 2025 05:27 Inactive
@cctdaniel cctdaniel marked this pull request as ready for review May 19, 2025 05:28
@vercel vercel bot temporarily deployed to Preview – insights May 19, 2025 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library May 19, 2025 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger May 19, 2025 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer May 19, 2025 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – staking May 19, 2025 05:32 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference May 19, 2025 05:32 Inactive
@cctdaniel cctdaniel merged commit 7e8c3f8 into main May 19, 2025
12 checks passed
@cctdaniel cctdaniel deleted the xc-admin-frontend-refactor branch May 19, 2025 05:46
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.

3 participants