0.7.15 • Published 4 years ago

voilk v0.7.15

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

GitHub license

Voilk.js

Voilk.js the JavaScript API for Voilk blockchain

Documentation

Here is full documentation: https://github.com/voilknetwork/voilk-js/tree/master/doc

Generate voilk.min.js

Clone the github repo, and compile it or just download the min file from latest release

git clone https://github.com/voilknetwork/voilk-js
cd voilk-js
npm run build

Browser

<script src="./voilk.min.js"></script>
<script>
voilk.api.getAccounts(['bilal', 'voilk'], function(err, response){
    console.log(err, response);
});
</script>

Webpack

Please have a look at the webpack usage example.

Server

Install

$ npm install voilk --save

RPC Servers

https://api.voilknetwork.com By Default

Examples

Broadcast Vote

var voilk = require('voilk');

var wif = voilk.auth.toWif(username, password, 'posting');
voilk.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
	console.log(err, result);
});

Get Accounts

voilk.api.getAccounts(['bilal', 'voilk'], function(err, result) {
	console.log(err, result);
});

Get State

voilk.api.getState('/trends/funny', function(err, result) {
	console.log(err, result);
});

Reputation Formatter

var reputation = voilk.formatter.reputation(user.reputation);
console.log(reputation);

Voilk Testnet

Voilk-js requires some configuration to work on the public Voilk testnet.

You need to set two Voilk API options, address_prefix and chain_id.

voilk.api.setOptions({
  address_prefix: 'TST',
  chain_id: '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32',
  useTestNet: true,
});

The Chain ID could change. If it does, it may not be reflected here, but will be documented on any testnet launch announcements.

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 talk to us at our discord group find link to join discord on https://voilk.com

Issues

When you find issues, please report them!

License

MIT