Skip to content

hongzhongx/taiyi-js

Repository files navigation

GitHub license Build Status Package Version

Taiyi.js

Taiyi.js the JavaScript API for Taiyi network

Documentation

Here is full documentation: https://github.com/hongzhongx/taiyi-js/tree/master/doc/README.md

Browser

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

CDN

https://cdn.jsdelivr.net/npm/@taiyinet/taiyi/dist/taiyi.min.js

<script src="https://cdn.jsdelivr.net/npm/@taiyinet/taiyi/dist/taiyi.min.js"></script>

Webpack

Please have a look at the webpack usage example.

Server

Install

$ npm install @taiyinet/taiyi-js --save

RPC Servers

https://api.taiyi.com By Default

Examples

Broadcast Vote

var taiyi = require('@taiyinet/taiyi-js');

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

Get Accounts

taiyi.api.getAccounts(['taisifu', 'zuowangdao'], function(err, result) {
	console.log(err, result);
});

Taiyi Testnet

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

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

taiyi.api.setOptions({
  address_prefix: 'TAI',
  chain_id: '18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e',
  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.

Issues

When you find issues, please report them!

License

MIT

Releases

No releases published

Packages

No packages published

Languages