bitgesell-blockchain-sdk
v1.2.1
Published
A comprehensive library for Bitgesell API
Downloads
1
Readme
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
- Fork repo
- Checkout a feature branch
- Setup environment:
cd bitgesell-blockchain-sdk/
npm install
- 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