benchcore-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

BenchCore API Client (Typescript)

A BenchCore API wrapper, written in TypeScript to interact with BenchCore rootchains and sidechains.

npm npm license

benchcore-api is a library client designed to facilitate how you interact with BenchCore RootChains and SideChains.

Why TypeScript

  • TypeScript is is a superset of JavaScript which mainly offers optional static typing, classes, and interfaces. The learning curve is not that steep.
  • Types are optional, benchcore-api compiles into ES5 so you can work with both, ECMAScript or TypeScript.
  • A better development experience, including auto-complete and fully documented.

Documentation

API documentation is hosted on GitHub Pages, and is generated from TypeDoc.

Installation

benchcore-api is avaliable from npm.

yarn add benchcore-api

or

npm i benchcore-api --save

Usage

For the best TypeScript experience, you should either use Visual Studio Code, or a plug-in for your favorite text editor.

Basic Examples

Get delegate list from Dexnet network.

import { Client, Network, NetworkType } from 'benchcore-api';

const dexnet = Network.getDefault(NetworkType.Dexnet);
const client = new Client(dexnet);

client.delegate.list().subscribe((list) => {
  console.log(list);
});

Get address from passphrase.

import { PrivateKey } from 'benchcore-api/core';

// if no specify a second param, default is bench
const key = PrivateKey.fromSeed('again sell dizzy shoes stumble bonus salt two exhibit slender romance fade');
console.log(key.getPublicKey().getAddress()); // BAfYEq6hRSMwV2yx45M1bpNx5KgdPyVBZW

For more examples please see documentation or look for tests in each directory.

Running the tests

npm run test

Credits

Jared Rice Sr. - @jaredricesr; Lúcio Rubens - @luciorubeens;

License

BenchCore API (benchcore-api) is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i benchcore-api

Weekly Downloads

5

Version

0.1.5

License

MIT

Unpacked Size

186 kB

Total Files

92

Last publish

Collaborators

  • benchpay