This package includes the API client and common classes and utils.
This package supports both Node.js and Web platforms. Please refer to the documentation how to select the platform.
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.
Clone this repository and run
npm install
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