0.2.1 • Published 7 years ago
grin-client v0.2.1
grin-client-js
A JavaScript client for Grin's V1 API.
Install
$ npm install grin-clientUsage
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