Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.32 KB

README.md

File metadata and controls

53 lines (36 loc) · 1.32 KB

electrum-client-ts

JavaScript implementation of Electrum Protocol Client.

This is a library that can communicate with the ElectrumX Server on tcp, ssl, ws and wss protocols.

Works in node.js and browser.

Implements methods described in Electrum Protocol methods documentation.

Subscriptions and notifications are also supported, please see example.

Install

npm install --save @bilthon/electrum-client-ts

Usage

import { ElectrumClient } from "@bilthon/electrum-client-ts";
async function main() {
  const client = new ElectrumClient("electrum.bitaroo.net", 50002, "ssl");

  try {
    await client.connect(
      "electrum-client-js", // optional client name
      "1.4.2" // optional protocol version
    );

    const header = await client.blockchain_headers_subscribe();
    console.log("Current header:", header);

    await client.close();
  } catch (err) {
    console.error(err);
  }
}

main();

See more examples.

Notice

This is a fork of @gemlinkofficial/electrum-client-ts with some minor changes to the original code.