https://github.com/zoobc/zoobc-sdk
Small set of libraries written with TypeScript and compiled to be JavaScript, making it easy to implement / integrate applications so that they connect with the P2P API of the nodes in the blockchain for the Web API of the explorer servers and wallet.
https://github.com/zoobc/zoobc-sdk
blockchain grpc grpc-web javascript typescript
Last synced: 9 months ago
JSON representation
Small set of libraries written with TypeScript and compiled to be JavaScript, making it easy to implement / integrate applications so that they connect with the P2P API of the nodes in the blockchain for the Web API of the explorer servers and wallet.
- Host: GitHub
- URL: https://github.com/zoobc/zoobc-sdk
- Owner: zoobc
- License: mit
- Created: 2019-07-01T09:09:55.000Z (almost 7 years ago)
- Default Branch: develop
- Last Pushed: 2021-03-28T01:28:34.000Z (about 5 years ago)
- Last Synced: 2025-05-07T23:34:58.762Z (about 1 year ago)
- Topics: blockchain, grpc, grpc-web, javascript, typescript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/zbc-sdk
- Size: 25.6 MB
- Stars: 0
- Watchers: 4
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

# ZooBC-SDK




ZooBC-SDK is a small set of libraries written with TypeScript and compiled to be JavaScript, making it easy to implement / integrate applications so that they connect with the P2P API of the nodes in the blockchain for the Web API of the explorer servers and wallet.
## Start using ZooBC-SDK
For instructions on how to use web and mobile for a project, please refer to these documents:
- [AngularJs](examples/angular)
- [Ionic](examples/ionic)
- [ReactJs](examples/react)
- [React Native](https://github.com/zoobc/zoobc-thumbwar.git)
- [VueJs](examples/vue)
## General Usage
Add 'zbc-sdk' packages to your project by executing:
```bash
$ npm install zbc-sdk
or
$ yarn add zbc-sdk
```
Here's an example of basic usage for connection:
```bash
import React, { useState, useEffect } from 'react';
import zoobc from 'zbc-sdk';
const App = () => {
const [blocks, setBlocks] = useState([])
const [error, setError] = useState(null)
const [detail, setDetail] = useState(null)
useEffect(() => {
const hosts = [
{ host: 'http://your-ip-address:your-port', name: 'Testnet' },
];
zoobc.Network.list(hosts)
listBlocks();
}, [])
const listBlocks = () => {
zoobc.Block
.getBlocks({height: 0})
.then(res => setBlocks(res.blocksList))
.catch(err => setError(err))
};
const onClickBlockId = (id) => {
zoobc.Block
.getBlockById(id)
.then(res => {
setDetail(res)
setError(null)
})
.catch(err => {
setError(err)
setDetail(null)
})
}
const onClickBlockHeight = (height) => {
zoobc.Block
.getBlockByHeight(height)
.then(res => {
setDetail(res)
setError(null)
})
.catch(err => {
setError(err)
setDetail(null)
})
}
return (
<>
{!!error && (
<>
Error
{JSON.stringify(error)}
>
)}{!!detail && (
<>
Detail
{JSON.stringify(detail)}
>
)}
Id
Previous Hash
Height
Timestamp
Version
{blocks.length > 0 &&
blocks.map((data, key) => {
return (
onClickBlockId(data.block.id)}>
{data.block.id}
{data.block.previousblockhash}
onClickBlockHeight(data.block.height)}>
{data.block.height}
{data.block.timestamp}
{data.block.version}
);
})}
>
)
}
export default App;
```
## Contributors
Thanks to all who have [contributed](https://github.com/zoobc/zoobc-sdk/graphs/contributors) to ZooBC-SDK!
Gungde
Eko
Irfan
Yandi
Nata
Bagas
Kevin
Adhiim
Witarsana
## License
This project is licensed under the Apache License - see the [LICENSE](LICENSE) file for details