Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pocesar/node-nxt-api
API request for NXT crypto
https://github.com/pocesar/node-nxt-api
Last synced: 17 days ago
JSON representation
API request for NXT crypto
- Host: GitHub
- URL: https://github.com/pocesar/node-nxt-api
- Owner: pocesar
- License: mit
- Created: 2014-09-01T06:45:33.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-24T03:22:49.000Z (over 9 years ago)
- Last Synced: 2024-10-18T06:28:12.631Z (27 days ago)
- Language: JavaScript
- Size: 308 KB
- Stars: 6
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/pocesar/node-nxt-api.svg?branch=master)](https://travis-ci.org/pocesar/node-nxt-api)
[![Coverage Status](https://img.shields.io/coveralls/pocesar/node-nxt-api.svg)](https://coveralls.io/r/pocesar/node-nxt-api?branch=master)NXT API
============API request wrapper for [NXT crypto](http://wiki.nxtcrypto.org/wiki/Nxt_API) for Node.js and the browser.
It just has all the currently public API methods for NXT along side with a dual API Promise/Callback based interface.Plus it's created using Typescript, which should ensure the proper parameters for each API call.
## Install
For node.js
```
npm -g install typescript
npm install nxt-api
```For the browser
```
bower install nxt-api
```## Usage
In Node.js:
```javascript
var NXT = require('nxt-api');// start your NRS client first
var API = new NXT.API('http://127.0.0.1:6876');API.getNextBlockGenerators().then(function (answer) {
console.log(answer);
});API.rsConvert({ account: 'x' }).then(function (answer) {
// should error
}, function (error) {
console.log(error);
});
```In the browser (needs to have `nxt.apiServerCORS=true` in your NXT config file, otherwise you need to access it from same port and hostname):
```html
var instance = new NXT.API('http://127.0.0.1:7876');
instance.getNextBlockGenerators().then(function(answer){
console.log(answer);
});```
## Example
Start the NRS in testNet mode, then run
```
npm run example
```## TODO
- Missing JSDocs for most of the functions
## Support
* `BTC: 1PskTzQjmzqB2boz67AXsv4C5YNWN4xmhu`
* `NXT: NXT-7TJT-8NS2-8QBS-5Y89X`