Options
All
  • Public
  • Public/Protected
  • All
Menu

burstjs - The Burstcoin Reference Library

burstjs

The BurstCoin Type/Javascript Reference Library


lerna Codacy Badge Build Status Known Vulnerabilities

codecov

@burstjs is a modern library written in Typescript providing common functionalities for browsers and nodejs to interact with the BurstCoin blockchain, an advanced community-driven blockchain technology.

This library is part of the Phoenix project, i.e. the new Burstcoin Wallet for Web, Desktop, Android, and iOS.

Packages

The library is separated in the following packages

  • @burstjs/core The main package providing an extense API for blockchain interaction
  • @burstjs/crypto A package providing BURST relevant crypto functions
  • @burstjs/util A package providing useful functions, e.g. common conversion functions
  • @burstjs/http A package providing a simplified Http layer, with consistent response types, and exception handling

Installation

@burstjs aims modern browsers and nodejs > v10

Usually, you won't need to install other packages than @burstjs/core, which uses the other packages.

npm install @burstjs/core
npm install @burstjs/crypto
npm install @burstjs/util
npm install @burstjs/http

Usage

The following example shows how to interact with the blockchain, i.e. getting the balance of a specific account

import {composeApi, ApiSettings} from '@burstjs/core'
import {convertNQTStringToNumber} from '@burstjs/util'

const apiSettings = new ApiSettings('https://wallet1.burst-team.us:2083', 'burst');
const api = composeApi(apiSettings);

(async () => {
  try{
    const balanceNQT = await api.account.getAccountBalance('5810532812037266198') // poloniex exchange account
    console.log(`Account Balance: ${convertNQTStringToNumber(balanceNQT)} BURST`)  
  }
  catch(e){ // e is of type HttpError (as part of @burstjs/http)
    console.error(`Whooops, something went wrong: ${e.message}`)      
  }
})()

Generated using TypeDoc