What is SubWallet Extension?
SubWallet Extension is a browser extension wallet forked from polkadot-js/extension, designed to support multiple blockchain networks while maintaining the ability to rebase with the polkadot-js origin at any time. It provides a comprehensive solution for managing crypto assets across different chains within a browser environment.Technical Perspective
SubWallet Extension is built as a multi-package monorepo that follows Chrome Extension architecture patterns. The extension operates across three main execution contexts:- Background environment - Handles message passing, state management, and API calls
- Extension UI - React-based frontend for popup and portfolio views
- Inject scripts - Scripts injected into web pages to enable dapp interactions
Tech Stack
SubWallet Extension is built with the following core technologies:TypeScript
Fully typed codebase for better developer experience and code safety
React
UI components built with React and Redux Toolkit for state management
Polkadot.js
Core blockchain interaction libraries from the Polkadot ecosystem
Webpack
Module bundler for compiling the extension for different browsers
Key Dependencies
- @polkadot/api (^16.4.2) - Blockchain API interactions
- @subwallet/chain-list (0.2.124) - Multi-chain support definitions
- Redux Toolkit - State management with react hooks
- RxJS (^7.8.1) - Reactive programming for subscriptions
- Dexie (^3.2.2) - IndexedDB wrapper for local storage
- bitcoinjs-lib (6.1.5) - Bitcoin protocol support
Architecture Overview
The extension consists of three primary components:
- Background Environment - Core processing engine
- Extension Pages - User-facing interfaces
- Inject Scripts - Dapp integration layer
What Can Developers Build?
Extension Development
Developers can extend SubWallet’s functionality by:- Adding new blockchain network support
- Implementing custom API integrations
- Creating new storage stores for persistent data
- Building custom cronjobs for background tasks
- Adding new UI components and pages
Dapp Integration
Dapp developers can integrate with SubWallet to:- Connect to user wallets via the injected provider
- Request account access and signatures
- Interact with multiple blockchain networks
- Leverage MetaMask compatibility mode
Available Packages
extension-base
extension-base
Core features running in background: API calls, data persistence, and script injection
extension-dapp
extension-dapp
Convenience wrapper for dapps to work with injected objects and simplify integration
extension-inject
extension-inject
Wrapper allowing extension developers to inject their extension for dapp use
extension-chains
extension-chains
Chain definitions and stripped-down metadata formats for supported networks
extension-koni-base
extension-koni-base
Custom package extending extension-base with SubWallet-specific features
extension-koni-ui
extension-koni-ui
React UI components for the extension popup and portfolio views
extension-koni
extension-koni
Main entry point containing injection and background processing logic
extension-compat-metamask
extension-compat-metamask
MetaMask compatibility layer for EVM chain support
Development Workflow
SubWallet Extension uses modern development practices:- Monorepo structure with Yarn workspaces
- Automated testing with Jest
- Code quality enforced with ESLint
- CI/CD with GitHub Actions for automated builds
- Internationalization support with i18next
Getting Started
Ready to start developing? Head over to the Setup Guide to get your development environment configured.Resources
GitHub Repository
View the source code and contribute
Report Issues
Submit bugs and feature requests
Architecture Guide
Deep dive into the extension architecture
Setup Guide
Get your development environment ready