Voilk.js the JavaScript API for Voilk blockchain
Here is full documentation: https://github.com/voilknetwork/voilk-js/tree/master/doc
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
<script src="./voilk.min.js"></script>
<script>
voilk.api.getAccounts(['bilal', 'voilk'], function(err, response){
console.log(err, response);
});
</script>
Please have a look at the webpack usage example.
$ npm install voilk --save
https://api.voilknetwork.com By Default
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);
});
voilk.api.getAccounts(['bilal', 'voilk'], function(err, result) {
console.log(err, result);
});
voilk.api.getState('/trends/funny', function(err, result) {
console.log(err, result);
});
var reputation = voilk.formatter.reputation(user.reputation);
console.log(reputation);
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.
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
When you find issues, please report them!
MIT