Skip to content

Typescript API Client For BenchCore RootChains and SideChains

License

Notifications You must be signed in to change notification settings

BenchCore/benchcore-api

Repository files navigation

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.

Releases

No releases published

Packages

No packages published