Package Exports
- ws-electrumx-client
- ws-electrumx-client/build/main/index.js
- ws-electrumx-client/build/module/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ws-electrumx-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ws-electrumx-client
Light electrum x websocket client.
Installation
npm install ws-electrumx-client
# or with yarn
yarn add ws-electrumx-clientUsage
import { ElectrumWS } from 'ws-electrumx-client';
const electrum = new ElectrumWS('wss://blockstream.info/liquidtestnet/electrum-websocket/api');
const response = await electrum.batchRequest(
{
method: 'blockchain.estimatefee',
params: [1],
},
{
method: 'blockchain.block.header',
params: [1],
}
);Development
Setup
yarn installBuild
yarn buildTest
Some tests requires nigiri to be installed and running as well as a websocat instance mapping the electrumx port to a local ws endpoint.
nigiri start --liquidYou can map the nigiri electrum port to a local websocket endpoint using solsson/websocat docker image:
docker run --net=host solsson/websocat -b ws-l:127.0.0.1:1234 tcp:127.0.0.1:50001&Then you can run the unit tests:
yarn testTest coverage
yarn covDocumentation
Generate and open in browser an HTML TypeDoc documentation:
yarn docLinter and Formatter
yarn fix