Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

aergoio/herajs-client

Repository files navigation

herajs - Javascript client framework for aergo

Travis_ci npm npm Greenkeeper badge

Tested with aergo server version 1.0.2

Documentation

Javascript client SDK for AERGO blockchain.

This package supports both Node.js and Web platforms. Please refer to the documentation how to select the platform.

Quick start

npm install @herajs/client

You can import the module both as CommonJS (require) and ES module (import).

import AergoClient from '@herajs/client';
let aergo = new AergoClient();
aergo.blockchain().then(result => {
    console.log('Current state', result);
});

Note that this by default imports the Node.js version which is not compatible with browsers. If you target web browsers, either import AergoClient from '@herajs/client/dist/herajs.js'; or create an alias in your bundler configuration. Many bundlers like Webpack automatically pick the browser version, so you don't need to configure anything.

You can also directly import the pre-built bundle in HTML using <script src="herajs/dist/herajs.min.js"></script> and use the global herajs variable.

Contribute

Setup

Clone this repository and run

npm install

Scripts

Run tests (requires a local Aergo node running in --testmode, listening on port 7845).

npm run test

Regenerate GRPC type definitions

npm run grpc

Development build with auto-update

npm run dev

Build all targets for distribution

npm run build