JSPM

ws-electrumx-client

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1353
  • Score
    100M100P100Q92603F
  • License MIT

Light electrum x websocket client

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-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

Acknowledgements