GithubHelp home page GithubHelp logo

naftalimurgor / bitgesell-blockchain-sdk Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 1019 KB

TypeScript Wrapper for Bitgesell Blockchain API for use on the Browser and Nodejs

Home Page: https://naftalimurgor.github.io/bitgesell-blockchain-sdk/

License: MIT License

TypeScript 99.42% JavaScript 0.58%
bitcoin bitgesell blockchain

bitgesell-blockchain-sdk's Introduction

Bitgesell Blockchain SDK

A comprehensive library for interacting Bitgesell API on Web, Nodejs and other JavaScript runtimes through the Bitgesell API

For a full documentation, see the docs:

Getting started

Install via yarn/npm:

yarn add bitgesell-blockchain-sdk # npm i bitgesell-blockchain-sdk 

Initialization

To initialize the sdk library

import {BitgesellBlockchainSDK} from 'bitgesell-blockchain-sdk'

const sdkConfig = {
  baseAPIURL: 'https://api.bitaps.com/bgl/v1/blockchain',
 logger: console.log // optional
}

const bitgesellBlockchainSDK = new BitgesellBlockchainSDK(sdkConfig)

To initialize the sdk library in Commonjs pattern:

const {BitgesellBlockchainSDK} = require('bitgesell-blockchain-sdk')

const sdkConfig = {
  baseAPIURL: 'https://api.bitaps.com/bgl/v1/blockchain',
 logger: console.log // optional
}

const bitgesellBlockchainSDK = new BitgesellBlockchainSDK(sdkConfig)

Query Transactions

To query transacton by the transaction hash:

(async() => {
    const txHash = 'e56d609044b4839d840ef4db4ac0534306cc11b257b8b4a71e8fb7491aaca9a9'
    const transaction = await bitgesellBlockchainSDK.tx.getTransactionByHash(txHash)
    console.log(transaction)
})()

Query the Mempool

To query mempool state:

(async() => {
    const mempoolState = await bitgesellBlockchainSDK.mempool.getMempoolState()
    console.log(mempoolState)
})()

Query Blocks

To query block by the blockHeight:

(async() => {
    const block = await bitgesellBlockchainSDK.blockchain.getBlockByHeight(206)
    console.log(block)
})()

Development

  1. Fork repo
  2. Checkout a feature branch
  3. Setup environment:
cd bitgesell-blockchain-sdk/
npm install
  1. Run unit tests:
cd bitgesell-blockchain-sdk/
npm test

NB: Remember to add tests to keep the coverage as reasonable as possible.

Documentation

For complete documenation on how to use this library see the complete docs

Try out in this codepen

Support

Any form of support is highly welcome through contributions, pull requests and feature requests.

License: MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.