Lightweight ElectrumX WebSocket client for Bitcoin and Liquid blockchain interactions. Current stable version 1.0.5, released with TypeScript type definitions. Provides a simple batch request API for sending Electrum JSON-RPC commands over WebSocket connections. Differentiates from alternatives like electrum-client by focusing exclusively on WebSocket transport and providing a minimal, promise-based interface with automatic batch request handling. Suitable for Node.js (>=10) and modern browsers with WebSocket support.
npm install ws-electrumx-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an ElectrumWS client connected to a Liquid testnet WebSocket endpoint and sends a batch request with two methods.
Use the client.on('open', callback) or wait for the first batch request to trigger automatic connection.Wrap batchRequest in try/catch and check each response for error field.
Use batchRequest with method/params objects instead of calling individual RPC methods.
Use a bundler alias to substitute 'ws' with the browser's native WebSocket, or avoid importing 'ws' by ensuring the package is used in a browser context where WebSocket is global.
Change to: import { ElectrumWS } from 'ws-electrumx-client'Install with npm install ws-electrumx-client, or use dynamic import() in CommonJS code.