How citadel-foss/portal works
Portal is a Bitcoin wallet and OpenSwap client/router, offered through desktop and headless-web hosts. Users connect or set up a wallet, then manage funds, discover offers, perform and recover swaps; router users configure liquidity, run routers, and review earnings. The React app calls a typed command boundary, while host-specific adapters provide desktop or web transport. The web host exposes authenticated HTTP routes and shared core operations. The README documents Tor, chain backends, backups, and updates; several implementation links remain unverified because their source was not excerpted.
Main entry points: App.tsx Application routes · ops Wallet and swap operations · commands.ts Typed commands · RouterWorkspacePage.tsx Router management
Components 28
User interface
- Application routes
src/App.tsx - Wallet and setup
src/pages/setup/SetupPage.tsx - Swap and recovery
src/pages/swap/SwapPage.tsx - Market discovery
src/pages/market/MarketPage.tsx - Router management
src/pages/router/RouterWorkspacePage.tsx - Router reports
src/pages/router/RouterSwapReportPage.tsx - Shared UI and formats
src/components/ui/display.tsx - Phrase confirmation
src/components/app/RecoveryPhrase.tsx - Session and connection
src/store/connection.ts
Host interfaces
- Typed commands
src/api/commands.ts - Host transport
src/api/transport.ts - Desktop adapter
src/api/desktop.ts - Web adapter
src/api/web.ts
Wallet and protocol core
- Wallet and swap operations
core/src/ops - Wallet state and types
core/src/state.rs - Wallet data storage
core/src/storage.rs - Tor networking
core/src/tor.rs - Chain backends
core/src/ops/chain_backend.rs
Web host
- HTTP routes
src-web/src/routes.rs - Web authentication
src-web/src/auth.rs - Web command dispatch
src-web/src/commands.rs - Web host state
src-web/src/state.rs - Web configuration
src-web/src/config.rs
Desktop host
- Desktop commands
src-tauri/src/commands
Other components
- Portal user
- Electrum or Bitcoin node
- Nostr market
- GitHub updates
Connections 33
- Portal user → Application routes: uses
src/App.tsx - Application routes → Wallet and setup: routes to
src/App.tsx - Application routes → Swap and recovery: routes to
src/App.tsx - Application routes → Market discovery: routes to
src/App.tsx - Application routes → Router management: routes to
src/App.tsx - Router management → Router reports: opens reports
- Application routes → Phrase confirmation: gates routes
src/App.tsx - Wallet and setup → Typed commands: requests commands
- Swap and recovery → Typed commands: requests commands
- Market discovery → Typed commands: requests commands
- Router management → Typed commands: calls commands
src/pages/router/RouterWorkspacePage.tsx - Router management → Shared UI and formats: renders
src/pages/router/RouterWorkspacePage.tsx - Shared UI and formats → Typed commands: uses commands
src/components/ui/display.tsx - Session and connection → Typed commands: calls commands
src/store/connection.ts - Typed commands → Host transport: invokes
src/api/commands.ts - Host transport → Desktop adapter: dispatches
- Host transport → Web adapter: dispatches
- Web adapter → HTTP routes: requests HTTP API
- Desktop adapter → Desktop commands: invokes commands
- HTTP routes → Web authentication: routes authentication
src-web/src/routes.rs - HTTP routes → Web command dispatch: routes commands
src-web/src/routes.rs - HTTP routes → Web host state: uses host state
src-web/src/routes.rs - Web host state → Web configuration: uses config
src-web/src/state.rs - Web command dispatch → Wallet and swap operations: dispatches operations
- Wallet and swap operations → Wallet state and types: uses state
- Wallet and swap operations → Wallet data storage: reads and writes
- Wallet and swap operations → Chain backends: uses backend
- Wallet and swap operations → Tor networking: uses Tor
- Wallet and swap operations → Nostr market: discovers offers
- Wallet and swap operations → Electrum or Bitcoin node: connects to chain
- Portal user → Electrum or Bitcoin node: configures backend
- Portal user → Nostr market: discovers market
- Application routes → GitHub updates: checks updates