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
- Add
electrumWsUrl?: string to ServiceWorkerWalletOptions and MessageBusInitConfig
- 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()
- 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.
Problem
ElectrumOnchainProviderandELECTRUM_WS_URLper-network constants exist in the SDK (landed in #450), butServiceWorkerWalletcan't use them. The service worker message bus only acceptsesploraUrland always creates anEsploraProviderinternally.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 noelectrumWsUrlconfig field.Proposed change
electrumWsUrl?: stringtoServiceWorkerWalletOptionsandMessageBusInitConfigmessageBus.tsbuildServices(), whenelectrumWsUrlis provided, create anElectrumOnchainProvider(viaElectrumWS+ELECTRUM_WS_URL) and pass it asonchainProvidertoWallet.create()/ReadonlyWallet.create()esploraUrlandelectrumWsUrlare provided,electrumWsUrltakes 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
esploraUrlfrom its ownexplorers.tsconfig toServiceWorkerWallet.setup(). Switching to electrum requires this SDK-side plumbing first.