Skip to content

Commit ee024e6

Browse files
committedNov 18, 2023
doc: update project README.md
1 parent 4336821 commit ee024e6

File tree

2 files changed

+77
-2
lines changed

2 files changed

+77
-2
lines changed
 

‎README.md

+77-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1-
# bglsdk
1+
# Bitgesell Blockchain SDK
2+
<img src="doc/Icon.png" style="height: 60px;"/>
23

3-
A comprehensive library for Bitgesell API
4+
A comprehensive library for interacting Bitgesell API on Web, Nodejs and other JavaScript runtimes through the Bitgesell API!
5+
6+
For a full documentation, see the docs:
7+
8+
## Getting started
9+
10+
Install via yarn/npm:
11+
```sh
12+
yarn add bgl-blockchain-sdk # npm i
13+
```
14+
15+
### Initialization
16+
17+
To initialize the sdk library
18+
19+
```javascript
20+
import {BitgesellBlockchain} from 'bitgesellblockchain'
21+
22+
const sdkConfig = {
23+
baseAPIURL: 'https://api.bitaps.com/bgl/v1/blockchain',
24+
logger: console.log // optional
25+
}
26+
27+
const bitgesellBlockchainSDK = new BitgesellBlockchainSDK(sdkConfig)
28+
```
29+
30+
To initialize the sdk library in Commonjs pattern:
31+
32+
```javascript
33+
const {BitgesellBlockchain} = require('bitgesellblockchain')
34+
35+
const sdkConfig = {
36+
baseAPIURL: 'https://api.bitaps.com/bgl/v1/blockchain',
37+
logger: console.log // optional
38+
}
39+
40+
const bitgesellBlockchainSDK = new BitgesellBlockchainSDK(sdkConfig)
41+
```
42+
### Query Transactions
43+
To query transacton by the transaction `hash`:
44+
45+
```javascript
46+
(async() => {
47+
const txHash = 'a transaction hash'
48+
const transaction = await bitgesellBlockchainSDK.tx.getTransactionByHash(txHash)
49+
console.log(txHash)
50+
})()
51+
```
52+
### Query the Mempool
53+
To query mempool state:
54+
55+
```javascript
56+
(async() => {
57+
const mempoolState = await bitgesellBlockchainSDK.mempool.getMempoolState()
58+
console.log(mempoolState)
59+
})()
60+
```
61+
62+
### Query Blocks
63+
To query block by the blockHeight:
64+
65+
```javascript
66+
(async() => {
67+
const block = await bitgesellBlockchainSDK.blockchain.getBlockByHeight(206)
68+
console.log(block)
69+
})()
70+
```
71+
72+
## Documentation
73+
For complete documenation on how to use this library see the complete docs:
74+
75+
## Support
76+
Any form of support is highly welcome through contributions, pull requests and feature requests.
77+
78+
```License```: MIT

‎doc/Icon.png

4.34 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.