Repository navigation
feat(networks): load network configs from external metadata repository - #78
Merged
Merged
Conversation
AugustoL
force-pushed
the
networks-from-metadata
branch
3 times, most recently
from
December 1, 2025 22:12
94e9b3e to
8e853b2
Compare
…ying The networks were not showing because `getEnabledNetworks()` was called synchronously during render before the async network data had loaded. - Derive `enabledNetworks` from `networks` state using useMemo in AppContext - Update Home.tsx to use `useNetworks()` hook from context - Add loading state while networks are being fetched
AugustoL
force-pushed
the
networks-from-metadata
branch
from
December 1, 2025 22:23
8e853b2 to
458035b
Compare
MatiasOS
approved these changes
Dec 2, 2025
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.
This pull request refactors how blockchain network metadata is managed and displayed in the app. Instead of hardcoding network information and logos, the app now fetches network data dynamically from an external metadata repository. This enables easier updates and scalability as new networks are added. The changes also centralize network state management in the app context and simplify how network icons are rendered.
Key changes include:
Dynamic Network Metadata Loading
networks.tsand components. Network metadata, including logos, is now loaded asynchronously from an external metadata service (MetadataService). The code includes caching and reload mechanisms for efficiency. [1] [2]AppContextnow manages network state, including loading, error handling, and access to enabled networks based on environment variables. A newuseNetworkshook provides this data to components. [1] [2]Component Refactoring for Dynamic Networks
NetworkBlockIndicatorandHomecomponents now use the newuseNetworkshook and context to access network data, instead of importing static lists. This allows them to display networks dynamically and react to loading states. [1] [2] [3] [4] [5] [6] [7] [8]Network Icon Handling
NetworkIconcomponent now loads network logos dynamically using URLs from the metadata. If a logo fails to load or is missing, it falls back to a generic Ethereum SVG icon. Legacy SVG icon components and static logo imports have been removed. [1] [2]Codebase Cleanup
NetworkBlockIndicatorandNetworkIcon. [1] [2] [3]These changes make the app more maintainable and ready to support a growing list of blockchain networks with minimal code changes.
Dynamic Network Metadata Loading
networks.tsto remove hardcoded network lists and instead fetch network metadata (including logo info) from an external service, with caching and reload support. [1] [2]AppContextto manage network state, including loading, enabled network filtering, and error handling; provided auseNetworkshook for easy access in components. [1] [2]Component Refactoring for Dynamic Networks
NetworkBlockIndicatorandHomecomponents to use the new context and hooks, supporting dynamic networks and improved loading state handling. [1] [2] [3] [4] [5] [6] [7] [8]Network Icon Handling
NetworkIconto load logos dynamically via URL, with fallback to Ethereum SVG if the logo is missing or fails to load; removed all static SVG icon code. [1] [2]Codebase Cleanup
NetworkContextfor global access to network data, update theNetworkIconcomponent to use dynamic logo URLs, and add a new metadata service for fetching and caching network information.Key changes:
Dynamic Network Configuration & Loading:
NetworkConfigand related logic insrc/config/networks.tsto load networks dynamically from the explorer-metadata repository via a new asyncloadNetworks()function, replacing the previous staticALL_NETWORKSarray. Added caching, conversion utilities, and new helpers for logo URLs and reloads. [1] [2] [3] [4]src/services/MetadataService.tsto handle fetching, caching, and parsing network metadata and logo URLs from the external repository.Network Context API:
This pull request refactors how network metadata is managed and accessed throughout the app. Instead of hardcoding network information and assets, the app now loads network metadata dynamically from an external source (the explorer-metadata repository) and provides this data via context. This makes the app more scalable and easier to update as new networks are added or existing ones change. The changes also standardize how network icons are rendered and how network information is retrieved in components.
Network metadata loading and context management:
src/config/networks.tswith dynamic loading from the explorer-metadata repository, including caching and utility functions for fetching, reloading, and accessing network data. [1] [2] [3]AppContextinsrc/context/AppContext.tsxto provide network data (including loading state, error handling, and reload capability) to the rest of the app, and addsuseNetworksanduseNetworkhooks for convenient access. [1] [2] [3] [4] [5]Component refactoring for network display:
src/components/common/NetworkBlockIndicator.tsxto use the new context-based network data and a unifiedNetworkIconcomponent, removing all direct imports of network logos and SVG icon logic. [1] [2] [3] [4]src/components/common/NetworkIcon.tsxto use a single entry point for network icons: it attempts to load the logo from metadata and falls back to a generic Ethereum SVG if not available or if loading fails. [1] [2]These changes improve maintainability, scalability, and consistency in how network information and icons are handled across the app.
NetworkContextinsrc/context/NetworkContext.tsxto provide network data, loading/error states, and reload functionality throughout the app.NetworkProviderin the top-level component tree insrc/App.tsxto wrap the application and supply network context. [1] [2]Network Icon Improvements:
NetworkIconinsrc/components/common/NetworkIcon.tsxto use dynamic logo URLs from metadata, with a fallback to an Ethereum icon if the logo fails to load. Removed static SVG imports and logic. [1] [2]These changes make the app more maintainable and future-proof by decoupling network data from the codebase and enabling easier updates via the metadata repository.