mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
Refactors the bridge feature to comply with the feature architecture standard established in #6936. Changes: - Add public API barrel (index.ts) with lazy-loaded Bridge component - Extract constants (BRIDGE_WIDGET_URL, LOCAL_STORAGE_CONSENT_KEY) to constants.ts - Create barrel files for hooks and components - Remove redundant inner dynamic() import in Bridge component - Update external imports to use public API Benefits: - Proper code splitting at feature boundary - Consistent structure with other features - Simplified lazy loading (single boundary instead of nested) - Improved maintainability Resolves: https://linear.app/safe-global/issue/WA-1259/refactor-bridge-feature-to-new-feature-architecture
4.1 KiB
4.1 KiB
Data Model: Bridge Feature Refactor
Feature: 002-bridge-refactor
Date: 2026-01-15
Overview
The bridge feature has no data model. It is a stateless UI feature that:
- Checks if the BRIDGE feature flag is enabled for the current chain
- Checks if the user is in a geoblocked region
- Renders an iframe embedding the LI.FI bridge widget
Entities
None. The feature does not define or manage any domain entities.
State Management
None. The feature does not use Redux or any other state management:
- Feature flag state: Provided by
useHasFeaturehook (external to this feature) - Geoblocking state: Provided by
GeoblockingContext(external to this feature) - Theme state: Provided by
useDarkModehook (external to this feature) - Chain state: Provided by
useCurrentChainhook (external to this feature)
Data Flow
┌─────────────────────────────────────────────────────────────────┐
│ Bridge Page │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Chain Config │────▶│ useHasFeature │─┐ │
│ │ (CGW API) │ │ (BRIDGE flag) │ │ │
│ └──────────────────┘ └──────────────────┘ │ │
│ │ │
│ ┌──────────────────┐ ┌──────────────────┐ │ ┌───────────┐ │
│ │ Geoblocking │────▶│ GeoblockingCtx │─┼─▶│ Bridge │ │
│ │ Service │ │ │ │ │ Component │ │
│ └──────────────────┘ └──────────────────┘ │ └───────────┘ │
│ │ │ │
│ useIsBridgeFeatureEnabled ─┘ │ │
│ ▼ │
│ ┌───────────────┐ │
│ ┌──────────────────┐ ┌──────────────────┐│ BridgeWidget │ │
│ │ useCurrentChain │────▶│ _getAppData ││ (LI.FI iframe)│ │
│ │ useDarkMode │────▶│ │└───────────────┘ │
│ └──────────────────┘ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Type Definitions
The feature requires minimal type definitions. The types.ts file will be created for consistency with the standard but will contain minimal content:
// types.ts
// Currently no feature-specific types needed.
// This file exists for consistency with the feature architecture standard.
// Types can be added here as the feature evolves.
export {}
If future requirements introduce types (e.g., bridge transaction tracking), they would be defined here.