How bubuanabelas/web3-redirector works
Key Components to Include:
Browser Extension Components
• Background Service Worker (represented by background.ts)
• Error Handler (represented by error.ts)
• Utility Services (helpers.ts and searchEngines.ts)
External Systems
• Web Browser (Firefox/Chrome)
• Blockchain Networks (for resolving .crypto, .eth domains)
• Traditional DNS System
• Web Servers (destination websites)
External Interactions
• On the left: User's Browser
• On the right: Blockchain Networks
• Bottom: Traditional DNS & Web Servers
Flow Representation
User Request -> Browser -> Extension Background Worker
Background Worker -> Blockchain Networks (for domain resolution)
Background Worker -> Traditional DNS (for resolved domains)
Background Worker -> Error Handler (when resolution fails)
Specific Flows
a. Domain Resolution Flow:
• User enters Web3 domain (.crypto, .eth)
• Background worker intercepts request
• Query to blockchain networks
• Resolution to traditional domain
• Redirect to resolved domain
b. Error Handling Flow:
• Failed resolution detection
• Error page rendering
• User feedback path
Technical Details
• TypeScript implementation notation
• Browser WebExtension API integration points
• Blockchain query interfaces
• Search engine integration points (from searchEngines.ts)
Important Notes
• Manifest.json configuration influence
• Background script's persistent nature
• Content script injection points
• Error.html rendering path
Remember to maintain a balance between showing the technical implementation details (TypeScript, WebExtension APIs) and the high-level architecture (domain resolution flow, blockchain interaction). This will help other developers understand both the overall system and its implementation details.