Skip to content

feat: add electrum support to ServiceWorkerWallet #483

@Kukks

Description

@Kukks

Problem

ElectrumOnchainProvider and ELECTRUM_WS_URL per-network constants exist in the SDK (landed in #450), but ServiceWorkerWallet can't use them. The service worker message bus only accepts esploraUrl and always creates an EsploraProvider internally.

The serialization boundary (MessageBusInitConfig) has no way to express "use electrum instead of esplora" — provider instances can't cross the worker boundary, and there's no electrumWsUrl config field.

Proposed change

  1. Add electrumWsUrl?: string to ServiceWorkerWalletOptions and MessageBusInitConfig
  2. In messageBus.ts buildServices(), when electrumWsUrl is provided, create an ElectrumOnchainProvider (via ElectrumWS + ELECTRUM_WS_URL) and pass it as onchainProvider to Wallet.create() / ReadonlyWallet.create()
  3. When both esploraUrl and electrumWsUrl are provided, electrumWsUrl takes precedence (or error — TBD)

This would allow the arkade wallet (and any other service-worker consumer) to switch to electrum by passing a single URL.

Context

The arkade wallet currently passes a custom esploraUrl from its own explorers.ts config to ServiceWorkerWallet.setup(). Switching to electrum requires this SDK-side plumbing first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions