Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 933 Bytes

Readme.md

File metadata and controls

44 lines (34 loc) · 933 Bytes

namecoin-rpc

namecoin-rpc is a simple wrapper for the namecoind client's JSON-RPC API.

This is a fork of the [node-bitcoin])https://github.com/freewil/node-bitcoin) repo and has been adapted for namecoin

The methods are exposed as lower camelcase methods on the rpc.Client object, or you may call the API directly using the cmd method.

Install

npm install namecoin-rpc

Examples

Create client

// all config options are optional
var rpc = require('namecoin-rpc');
var client = new rpc.Client({
  host: 'localhost',
  port: 8336,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

GetInfo

client.getInfo( [], function(err, result, resHeaders) {
  if (err) return console.log(err);
  console.log(result);
});

GetIno directly using cmd

client.cmd('getinfo', [], function(err, result, resHeaders){
  if (err) return console.log(err);
  console.log(result);
});