1.0.3 • Published 6 years ago

neo-api v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

NEO JavaScript API

Interface methods provide access to JSON-RPC NEO Nodes as well as Rest Services to AntChain and Neon.

Available on npm

Documentation

Building

npm run build

Creates two bundles: One for node module dist/neo.node.js and one for the Browser dist/neo.js

Installing

Each bundle is a UMD module and supports AMD, CommonJS, and vanilla environments. Developers can create a custom bundle using Rollup or any preferred bundler.

Usage

NodeJS

var neo = require('neo.node.js');

HTML:

<script src="neo.js"></script>

Use neo object in your JavaScript environment.

var localNode = neo.node('http://localhost:10332');
localNode.getBlockCount().then(function (result) {
    console.log('Current block height: ' + result);
});
localNode.getLastBlockHash().then(function (result) {
    console.log('Hash of last block: ' + result);
});
var options = {
    baseUrl: 'http://www.antchain.org/api/v1/',
    transform: neo.transforms.antchain
};
neo.antChain(options).getAddressValue('AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i').then(function (addressValue) {
    console.log(addressValue.antShare.value);
    console.log(addressValue.antCoin.value);
});

More examples coming soon!

Test

Run all the Tests:

npm test

Run only the REST API tests:

npm test test/rest.api.js

Run only the JSON-RPC API tests:

npm test test/rpc.api.js
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago