0.2.1 • Published 5 years ago

grin-client v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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