@ethergram/ether
v1.0.1
Published
Ether.js the JavaScript API for Ether blockchain
Downloads
5
Maintainers
Readme
Ether.js
Ether.js the JavaScript API for Ether blockchain
Documentation
Here is full documentation: https://github.com/ethergramnetwork/ether-js/tree/master/doc
Generate ether.min.js
Clone the github repo, and compile it or just download the min file from latest release
git clone https://github.com/ethergramnetwork/ether-js
cd ether-js
npm run build
Browser
<script src="./ether.min.js"></script>
<script>
ether.api.getAccounts(['bilal', 'ether'], function(err, response){
console.log(err, response);
});
</script>
Webpack
Please have a look at the webpack usage example.
Server
Install
$ npm install @ethergram/ether --save
RPC Servers
https://api.ethergramnetwork.com By Default
Examples
Broadcast Vote
var ether = require('@ethergram/ether');
var wif = ether.auth.toWif(username, password, 'posting');
ether.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
console.log(err, result);
});
Get Accounts
ether.api.getAccounts(['bilal', 'ether'], function(err, result) {
console.log(err, result);
});
Get State
ether.api.getState('/trends/funny', function(err, result) {
console.log(err, result);
});
Reputation Formatter
var reputation = ether.formatter.reputation(user.reputation);
console.log(reputation);
Ether Testnet
Ether-js requires some configuration to work on the public Ether testnet.
You need to set two Ether API options, address_prefix
and chain_id
.
ether.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://ethergram.io
Issues
When you find issues, please report them!
License
MIT