grin-client

0.2.1 • Public • Published

grin-client-js

A JavaScript client for Grin's V1 API.

Install

$ npm install grin-client

Usage

Example

const GrinClient = require('grin-client');

(async function () {
  const API_SECRET = '...';
  const grin = new GrinClient({
    protocol: 'http',
    hostname: '127.0.0.1',
    port: 3413,
    username: 'grin',
    password: API_SECRET,
  });

  try {
    const status = await grin.status();
    const block = await grin.blocks(13474);
    // ...
  } catch(e) {
    console.log(e);
  }
})();

API

.blocks(id)
  id: <string> can be hash, height or commit.
.headers(id)
  id: <string> can be hash, height or commit.
.chain()
.chainCompact()
.chainValidate()
.chainOutputsByIds(ids)
  ids: <string[]>
.chainOutputsByHeight(obj)
  obj: <Object>
    startHeight: <integer>
    endHeight: <integer>
.status()
.txhashsetRoots()
.txhashsetLastOutputs(n)
  n: <integer>
.txhashsetLastRangeProofs(n)
  n: <integer>
.txhashsetLastKernels(n)
  n: <integer>
.txhashsetOutputs(obj)
  obj: <Object>
    startIndex: <integer>
    max: <integer>
.txhashsetMerkleProof(id)
  id: <string>
.pool()
.peersBan(addr)
  addr: <string>
.peersUnban(addr)
  addr: <string>
.peersAll()
.peersConnected()
.peers(addr)
  addr: <string>

Related

grin-ql-js
API mimblewimble/grin

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i grin-client

Weekly Downloads

3

Version

0.2.1

License

MIT

Unpacked Size

74.1 kB

Total Files

22

Last publish

Collaborators

  • nijynot