grin-client
A JavaScript client for Grin's V1 API.
Last updated a year ago by nijynot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install grin-client 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.2.1                                ...           latest (a year ago)

2 Versions

  • 0.2.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 3
Last Month 1
Dependencies (2)
Dev Dependencies (3)
  • chai ^4.2.0
  • mocha ^5.2.0
  • nock git+https://github.com/nijynot/nock.git
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |