How resolvr-io/apogee works
Purpose and Entry Points
Apogee is an MV3 Chromium browser extension providing a self-custodial Liquid wallet and injected Liquid dapp provider. Build manifests define extension surfaces in manifest.config.ts and manifest.shared.ts. Runtime entry points are the background service worker (src/background/index.ts), offscreen wallet runtime (src/offscreen/offscreen.ts), side-panel React app (src/sidepanel/main.tsx), and page/content provider bridge (src/content/content.ts, src/provider/liquid-provider.ts).
Privileged Wallet Boundary
Keys, lwk_wasm, signing, descriptor derivation, chain synchronization, and transaction operations are confined to the offscreen document. The background worker brokers requests and serializes engine access, preventing UI and dapp calls from re-entrantly sharing cached wallet state. Core wallet protocol and operations reside in src/engine/protocol.ts, src/engine/engine-core.ts, and src/offscreen/offscreen.ts.
Persistence, Identity, and Locking
The keystore stores an encrypted local BIP-39 seed while retaining a cleartext watch-only descriptor for locked-state synchronization. It supports migrations and service-worker/session recovery; seeds are only decrypted for signing. Wallet identity and public descriptor handling are separated from signing material in src/keystore/keystore.ts, src/keystore/crypto.ts, src/engine/wallet-identity.ts, and src/engine/public-wallet-descriptor.ts. Jade wallets are seedless/watch-only locally.
UI and Approval Control Plane
The React side panel owns onboarding, unlock, portfolio, receive, send, swap, settings, and user-facing transaction/connection state. Sensitive dapp connection and transaction requests are routed into approval UI, using the side panel when available or a prompt surface otherwise. Principal surfaces are src/sidepanel/App.tsx, src/sidepanel/wallet-client.ts, src/sidepanel/screens/Approval.tsx, and src/prompt/prompt.tsx.
Dapp Provider Pipeline
A MAIN-world provider exposes window.apogee and compatibility surfaces, while an isolated content script relays page messages through Chrome runtime messaging. The background validates origin sessions, permissions, lock state, and approval outcomes before forwarding privileged requests to the engine. Provider methods cover wallet status/data, transfers, UTXOs, descriptor disclosure, and PSET signing/broadcast. Relevant boundaries are src/provider/liquid-provider.ts, src/provider/liquid-browser-provider-runtime.ts, src/content/content.ts, and src/background/index.ts.
Transaction and PSET Safety
Side-panel sends and provider calls converge on engine PSET construction/signing/broadcast. Provider-built PSETs receive wallet-scoped analysis and explicit capability/request approval before local or hardware signing; broadcasting is separately explicit. Transaction validation and output/recipient interpretation are implemented in src/engine/provider-pset-analyzer.ts, src/engine/provider-pset-review.ts, src/engine/verify-dealer-pset.ts, and src/provider/liquid-provider-pset-broadcast.ts.
External Integrations and Infrastructure
lwk_wasm is the Liquid Wallet Kit engine and uses Esplora for Liquid chain data. SideSwap integration supplies swap orchestration through src/sideswap/client.ts and src/sideswap/orchestrator.ts. Blockstream Jade support uses Web Serial in a dedicated pairing/signing window (src/jade/jade.ts, src/sidepanel/jade-window.ts). The project uses CRXJS/Vite, React, Tailwind, TypeScript, pnpm, and GitHub Actions; provider conformance has a standalone browser playground at playground/liquid-provider/main.ts.
Main entry points: index.ts Background broker · engine-core.ts Wallet engine core · manifest.config.ts MV3 manifests · offscreen.ts Offscreen wallet runtime
Components 17
Extension surfaces
- MV3 manifests · Defines extension runtime surfaces.
manifest.config.ts - Background broker · Serializes privileged requests and validates dapp sessions.
src/background/index.ts
Wallet security boundary
Offscreen runtime exclusively owns keys and wallet engine access.
- Offscreen wallet runtime · Exclusive execution boundary for keys, signing, and wallet state.
src/offscreen/offscreen.ts - Wallet engine core · Implements wallet protocol, synchronization, and transaction operations.
src/engine/engine-core.ts - Encrypted keystore · Stores encrypted seed and cleartext watch-only descriptor.
src/keystore/keystore.ts - Wallet identity · Separates public wallet identity from signing material.
- PSET safety review · Analyzes wallet-scoped PSETs and recipient outputs before approval.
src/engine/provider-pset-review.ts
Dapp provider pipeline
- MAIN-world provider · Exposes window.apogee and provider compatibility methods.
src/provider/liquid-provider.ts - Content bridge · Relays page messages through Chrome runtime messaging.
src/content/content.ts
User control plane
- Side panel app · Owns wallet flows and user-facing state.
src/sidepanel/App.tsx - Wallet client
src/sidepanel/wallet-client.ts - Approval UI · Collects connection and transaction decisions.
src/sidepanel/screens/Approval.tsx - Prompt surface · Used when the side panel is unavailable.
src/prompt/prompt.tsx
External integrations
- Liquid Wallet Kit · Provides Liquid wallet primitives and chain synchronization.
- Esplora
- SideSwap orchestration
src/sideswap/orchestrator.ts - Jade hardware wallet · Seedless local wallet pairing and hardware signing.
src/jade/jade.ts
Connections 21
- MV3 manifests → Background broker: declares
- MV3 manifests → Offscreen wallet runtime: declares
- MV3 manifests → Side panel app: declares
- MAIN-world provider → Content bridge: page messages
- Content bridge → Background broker: runtime messages
- Background broker → Offscreen wallet runtime: serialized privileged requests
- Background broker → Approval UI: approval requests
- Background broker → Prompt surface: fallback approval
- Side panel app → Wallet client: uses
- Wallet client → Background broker: wallet requests
- Approval UI → Background broker: decision
- Prompt surface → Background broker: decision
- Offscreen wallet runtime → Wallet engine core: runs
- Wallet engine core → Encrypted keystore: loads encrypted seed
- Wallet engine core → Wallet identity: uses public identity
- Wallet engine core → PSET safety review: reviews provider PSETs
- Wallet engine core → Liquid Wallet Kit: wallet primitives
- Liquid Wallet Kit → Esplora: chain data
- Wallet engine core → SideSwap orchestration: swap operations
- Wallet engine core → Jade hardware wallet: hardware signing
- PSET safety review → Approval UI: explicit capability approval