Skip to content
Peter Mai edited this page Jul 1, 2022 · 14 revisions

SubWallet Extension

Our SubWallet is forked from polkadot-js/extension. We aim to add more features while still maintaining our ability to rebase the polkadot origin at any time.

Main concept

Main Concept The extension is compiled from folder packages/extension-koni

  • Background environment:
    • Compiled from packages/extension-koni/src/background.ts.
    • Used to handle messages from Extensions pages and Chrome tabs via Chrome API Message Passing.
    • Saves all states to store and persist in Chrome local storage.
    • Runs cronjobs.
  • Extension:
    • Frontend and page of extension.
    • popup.html: Frontend page opens when users click on extension icon in browser.
    • portfolio.html: Frontend displays more complicated view.
  • Inject Scripts:
    • Inject scripts into Chrome tabs.

All data requests must be called and processed in the background. Extension Pages and Inject Scripts use data from the background environment and do not call APIs directly.

Project structure

  • extension-base - Contains main features running in background, calls API, persists data in Chrome local storage and injects scripts.
  • extension-dapp - Convenient wrapper that simplifies data extraction for any DApp wishing to integrate the extension (or any extension that supports the interface).
  • extension-inject - Convenient wrapper that allows extension developers to inject their extension for use by any DApp.
  • extension-chains - Definitions for chains that are supported by this extension, containing the bare definitions as well as a stripped-down (call-only) metadata format.
  • extension-dapp - Actual in-depth technical breakdown is given in the next section for any DApp developer wishing to work with raw objects injected into window. However, convenient wrappers are provided to allow any DApp to use this extension (or any other extension that conforms to the interface) without having to manage any additional info.
  • extension-mocks - Mock data for testing.
  • extension-compat-metamask - Compatible with Metamask.
  • extension-koni-base - Custom package, extension base
  • extension-koni-ui (replace extension-ui) - UI components for the extension to build up the pop-up.
  • extension-koni (replace extension) - All injection and background processing logic (main entry).

Highlight features

Highlight features will describe or design specify issues

Clone this wiki locally