1.0.2 • Published 3 years ago

@codewarriorr/btcv-api-client v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

BTCV api client

TypeScript 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 BTCV methods described in Electrum Protocol methods documentation.

Install

npm install --save @codewarriorr/btcv-api-client

Usage

const { BtcvApiClient } = require('@codewarriorr/btcv-api-client');

async function main() {
  const config = {
    host: '127.0.0.1',
    port: 5002,
    protocol: 'ssl',
  };
  const client = new BtcvApiClient(config);

  try {
    await client.connect();

    const header = await client.getCurrentBlock();
    console.log('Current header:', header);
  } catch (err) {
    console.error(err);
  } finally {
    await client.close();
  }
}

main();

See more examples.