ws-electrumx-client
v1.0.5
Published
Light electrum x websocket client
Downloads
176
Readme
ws-electrumx-client
Light electrum x websocket client.
Installation
npm install ws-electrumx-client
# or with yarn
yarn add ws-electrumx-client
Usage
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 install
Build
yarn build
Test
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 --liquid
You 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 test
Test coverage
yarn cov
Documentation
Generate and open in browser an HTML TypeDoc documentation:
yarn doc
Linter and Formatter
yarn fix