Skip to content

wasm-visor PWA: bundle skycoin-web wallet + route node API over dmsg #3442

Description

@0pcom

Bundle the skycoin-web thin-client wallet into the wasm-visor PWA (theskywirenetwork.net) so it loads same-origin (not over dmsg) and only the node data crosses the mesh. Substitute for the discontinued skycoin mobile wallets. Follows the coin-node work (#3436/#3438) and the port-80/Origin fixes (#3439/#3441).

Why this shape

  • skycoin-web is a transport-agnostic HTTP thin client (client-side crypto via skycoin-lite.wasm, wallets in browser localStorage, node picker via Settings→Nodes gated by enableCustomNodes). Keep it a frozen vendored asset — do NOT add dmsg to it (dmsg is in-tree at skywire/pkg/dmsg; skywire vendors skycoin; importing dmsg into skycoin ⇒ skywire→skycoin→skywire dependency cycle).
  • It's an external subprocess app (HTTP server on a port; the HV UI WalletComponent iframes it). A browser tab can't run a subprocess/TCP listener, so the wasm path serves the static dist and routes /api in-browser via override.js → Core.ServeHTTP.
  • Host-native already works with zero code change: HTTP_PROXY=socks5://127.0.0.1:4443 skywire skycoin web --node-url http://<host>.<b32>.dmsg (Go default transport + socks5h remote DNS — verified live). Tracked separately below.

Wasm PWA build (8 tasks)

  1. Copy vendor/.../src/skycoin-web/src/gui/dist (~11 MB; 4.7 MB is skycoin-lite.wasm) → pkg/visor/static/wallet/ (auto-embedded by //go:embed static). Add a Makefile sync target (à la make embed-wasm-visor).
  2. Rebuild the wallet with ng build --base-href /wallet/ (or post-rewrite index.html asset paths) so its assets resolve under /wallet/. (ng build needs node_modules → CI/host build.)
  3. serve.go: /wallet/ served by the existing fileServer fall-through once at static/wallet/ (verify dir-index behavior).
  4. override.js: route /api/v1/* and /api/v2/* → dmsg to the configured node pk:port; everything else → Core (HV API has no /v1//v2/, so the prefix cleanly disambiguates — no wallet rebuild needed for routing).
  5. pkg/wasmhv/router.go (Core): add an HTTP-over-dmsg fetch to a node pk:port (reuse the fetchDmsg / deep-link-gateway path).
  6. browse.js: menu entry "Skycoin Wallet" → WinBox iframe /wallet/ (mirror createChatWindow).
  7. sw.js: precache /wallet/* for offline launch.
  8. Node pk:port setting (default a known node; user-settable — the "wallet backend service"). Wallet keeps nodeUrl:'' → same-origin /api/v1 → override routes it.

Validation needs a wasm build + hv serve + CDP browser drive (load /wallet/, create a seed wallet, read the chain over dmsg).

Host-native follow-ups (separate, small)

  • Expose "route over dmsg" in the HV UI wallet tab: launch the skycoin-web app with HTTP_PROXY=visor resolving proxy + a .dmsg node-url (app-launcher env injection).
  • Add a --socks5/--proxy flag to skywire skycoin web as a belt-and-suspenders fallback to the env var.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions