Skip to content
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

Refactor: Improve API service architecture and add copyright notices #22

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

carloskiron
Copy link
Contributor

@carloskiron carloskiron commented Mar 3, 2025

API Service Architecture Improvements & Copyright Notices

This PR improves the architecture of our API services and adds copyright notices to all source files. It contributes to issue #5 by implementing a more robust and maintainable API connection management system.

Changes

API Service Architecture

  • Refactored ExplorerService to use a centralized Polkadot API connection
  • Implemented proper dependency injection using tsyringe
  • Created singleton pattern for API services to prevent multiple connections
  • Added new services:
    • PolkadotApiService: Manages Polkadot.js API connections
    • ChainStateService: Handles chain state queries and subscriptions
    • ExplorerClient: Provides a global singleton access point

Code Organization

  • Moved API-related code to dedicated service files
  • Created interfaces for all services to improve maintainability
  • Added proper type definitions
  • Improved error handling and connection state management

Copyright Notices

  • Added Apache 2.0 license copyright notice to all source files
  • Standardized file headers across the codebase

Testing

The changes have been tested for:

  • Proper API connection management
  • Connection state handling
  • Component re-rendering behavior

Breaking Changes

None. All existing functionality remains the same, but with improved internal architecture.

Next Steps

  • Integration of timelock library (remove etf.js dependency)
  • Unit tests for services

Contributes to #5

- Refactored ExplorerService to use centralized Polkadot API connection
- Added proper dependency injection with tsyringe
- Implemented singleton pattern for API services
- Added copyright notices to all source files
- Fixed connection state management
- Improved error handling

Contributes to #5
@carloskiron carloskiron added this to the Network Explorer Interface milestone Mar 3, 2025
@carloskiron carloskiron self-assigned this Mar 3, 2025
@carloskiron carloskiron merged commit 09b7a2e into main Mar 3, 2025
@carloskiron carloskiron deleted the cm/polkadot-api-integration branch March 3, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant