node-sia

1.0.2 • Public • Published

npm version npm downloads dependencies Status license:mit

Sia Client for Node.js

node-sia is a Node.js module that's made to interact with the Sia API.

See the Sia API documentation for an overview of endpoints.

Documentation

Constructor([data])

  • data - Optional. An object containing zero or more of the following properties:
    • options
      • url - URL to your Sia API endpoint. Defaults to http://127.0.0.1:9980
      • password - Password you have to set to authenticate with the Sia API. Should be used if you have started siad with the --authenticate-api flag.
    • request - An instance of request which will be used for HTTP requests. node-sia will create its own if omitted.

Constructs a new instance of SiaClient.

sendRequest(method, endpoint, parameters)

  • method - HTTP method (GET, POST)
  • endpoint - Sia API endpoint you want to reach.
  • parameters - Optional. An object containing your query strings.

Example:

var SiaClient = require('node-sia');
var client = new SiaClient();
 
client.sendRequest('GET', '/daemon/version')
    .then(function (data) {
        console.log(data);
    })
    .catch(function (err) {
        console.error(err);
    });
 
client.sendRequest('POST', '/wallet/init', {
    encryptionpassword: 'my super secure password'
}).then(function (data) {
    console.log(data);
}).catch(function (err) {
    console.error(err);
});

Readme

Keywords

none

Package Sidebar

Install

npm i node-sia

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

4.99 kB

Total Files

4

Last publish

Collaborators

  • heartz