Skip to content
Snippets Groups Projects
Commit 1b2292e2 authored by Mahdi Yari's avatar Mahdi Yari
Browse files

Update README.md

parent 03388084
No related branches found
No related tags found
1 merge request!4Fix browserbuild and readme
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/steemit/steem-js/blob/master/LICENSE) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.syncad.com/hive/hive-js/blob/master/LICENSE)
[![Steem.js channel on steemit.chat](https://img.shields.io/badge/chat-steemit.chat-1c56a4.svg)](https://steemit.chat/channel/steemjs)
# Steem.js # Hive.js
Steem.js the JavaScript API for Steem blockchain Hive.js the Official JavaScript API for Hive blockchain
# Documentation # Documentation
- [Install](https://github.com/steemit/steem-js/tree/master/doc#install) - [Install](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#install)
- [Browser](https://github.com/steemit/steem-js/tree/master/doc#browser) - [Browser](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#browser)
- [Config](https://github.com/steemit/steem-js/tree/master/doc#config) - [Config](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#config)
- [Database API](https://github.com/steemit/steem-js/tree/master/doc#api) - [Database API](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#api)
- [Subscriptions](https://github.com/steemit/steem-js/tree/master/doc#subscriptions) - [Subscriptions](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#subscriptions)
- [Tags](https://github.com/steemit/steem-js/tree/master/doc#tags) - [Tags](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#tags)
- [Blocks and transactions](https://github.com/steemit/steem-js/tree/master/doc#blocks-and-transactions) - [Blocks and transactions](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#blocks-and-transactions)
- [Globals](https://github.com/steemit/steem-js/tree/master/doc#globals) - [Globals](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#globals)
- [Keys](https://github.com/steemit/steem-js/tree/master/doc#keys) - [Keys](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#keys)
- [Accounts](https://github.com/steemit/steem-js/tree/master/doc#accounts) - [Accounts](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#accounts)
- [Market](https://github.com/steemit/steem-js/tree/master/doc#market) - [Market](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#market)
- [Authority / validation](https://github.com/steemit/steem-js/tree/master/doc#authority--validation) - [Authority / validation](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#authority--validation)
- [Votes](https://github.com/steemit/steem-js/tree/master/doc#votes) - [Votes](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#votes)
- [Content](https://github.com/steemit/steem-js/tree/master/doc#content) - [Content](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#content)
- [Witnesses](https://github.com/steemit/steem-js/tree/master/doc#witnesses) - [Witnesses](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#witnesses)
- [Login API](https://github.com/steemit/steem-js/tree/master/doc#login) - [Login API](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#login)
- [Follow API](https://github.com/steemit/steem-js/tree/master/doc#follow-api) - [Follow API](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#follow-api)
- [Broadcast API](https://github.com/steemit/steem-js/tree/master/doc#broadcast-api) - [Broadcast API](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#broadcast-api)
- [Broadcast](https://github.com/steemit/steem-js/tree/master/doc#broadcast) - [Broadcast](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#broadcast)
- [Auth](https://github.com/steemit/steem-js/tree/master/doc#auth) - [Auth](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#auth)
Here is full documentation: Here is full documentation:
https://github.com/steemit/steem-js/tree/master/doc https://gitlab.syncad.com/hive/hive-js/tree/master/doc
## Browser ## Browser
```html ```html
<script src="./steem.min.js"></script> <script src="./hive.min.js"></script>
<script> <script>
steem.api.getAccounts(['ned', 'dan'], function(err, response){ hive.api.getAccounts(['mahdiyari', 'hiveio'], function(err, response){
console.log(err, response); console.log(err, response);
}); });
</script> </script>
``` ```
## CDN ## CDN
https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js<br/> https://cdn.jsdelivr.net/npm/@hiveio/hive-js/dist/hive.min.js<br/>
```html ```html
<script src="https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js"></script> <script src="hhttps://cdn.jsdelivr.net/npm/@hiveio/hive-js/dist/hive.min.js"></script>
``` ```
## Webpack ## Webpack
[Please have a look at the webpack usage example.](https://github.com/steemit/steem-js/blob/master/examples/webpack-example) [Please have a look at the webpack usage example.](https://gitlab.syncad.com/hive/hive-js/blob/master/examples/webpack-example)
## Server ## Server
## Install ## Install
``` ```
$ npm install steem --save $ npm install @hiveio/hive-js --save
``` ```
## RPC Servers ## RPC Servers
https://api.steemit.com By Default<br/> https://api.hive.blog By Default<br/>
https://node.steem.ws<br/> https://anyx.io<br/>
https://this.piston.rocks<br/> https://api.openhive.network<br/>
https://api.hivekings.com<br/>
https://api.pharesim.me<br/>
https://hived.privex.io<br/>
https://rpc.ausbit.dev<br/>
https://rpc.esteem.app<br/>
<sub>[List of Hive nodes](https://hivekings.com/nodes)</sub><br/>
## Examples ## Examples
### Broadcast Vote ### Broadcast Vote
```js ```js
var steem = require('steem'); var hive = require('@hiveio/hive-js');
var wif = steem.auth.toWif(username, password, 'posting'); var wif = hive.auth.toWif(username, password, 'posting');
steem.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) { hive.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
console.log(err, result); console.log(err, result);
}); });
``` ```
### Get Accounts ### Get Accounts
```js ```js
steem.api.getAccounts(['ned', 'dan'], function(err, result) { hive.api.getAccounts(['mahdiyari', 'hiveio'], function(err, result) {
console.log(err, result); console.log(err, result);
}); });
``` ```
### Get State ### Get State
```js ```js
steem.api.getState('/trends/funny', function(err, result) { hive.api.getState('/trends/funny', function(err, result) {
console.log(err, result); console.log(err, result);
}); });
``` ```
### Reputation Formatter ### Reputation Formatter
```js ```js
var reputation = steem.formatter.reputation(user.reputation); var reputation = hive.formatter.reputation(user.reputation);
console.log(reputation); console.log(reputation);
``` ```
### Steem Testnet ### Hive Testnet
Steem-js requires some configuration to work on the public Steem testnet. Hive-js requires some configuration to work on the public Hive testnet.
You need to set two Steem API options, `address_prefix` and `chain_id`. You need to set two Hive API options, `address_prefix` and `chain_id`.
```js ```js
steem.api.setOptions({ hive.api.setOptions({
address_prefix: 'TST', address_prefix: 'TST',
chain_id: '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32', chain_id: '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32',
useTestNet: true, useTestNet: true,
...@@ -107,7 +112,7 @@ steem.api.setOptions({ ...@@ -107,7 +112,7 @@ steem.api.setOptions({
The Chain ID could change. If it does, it may not be reflected here, but will be documented on any testnet launch announcements. The Chain ID could change. If it does, it may not be reflected here, but will be documented on any testnet launch announcements.
## Contributions ## Contributions
Patches are welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list or on Steemit Chat channel #steemjs https://steemit.chat/channel/steemjs. Patches are welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them.
## Issues ## Issues
When you find issues, please report them! When you find issues, please report them!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment