Giter Club home page Giter Club logo

neo-api-js's Introduction

neo-api

NEO JavaScript API for connecting to a NEO Network.

NEO JavaScript API

This api library is currently being used by Neo Network Status Monitor (NeoMon)

Interface methods provide access to JSON-RPC NEO Nodes as well as Neo REST service providers. This is a barebones API framework providing wrappers around commonly known NEO endpoints. No crypto libraries for reading / writing transactions are provided. The framework is intended to be used for getting state information from service end points. The APIs for writing transactions may be included but the capability to write and sign those transactions is left up to other frameworks.

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.getBestBlockHash().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

neo-api-js's People

Contributors

canesin avatar ffox77 avatar lobosque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-api-js's Issues

Release new version on npm

Why not release this current master on npm? There are some methods like getNewAddress that are not in the current version in npm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.