minterjs

0.5.0 • Public • Published

minterjs

Development in progress. Welcome to contribute!

NPM: https://www.npmjs.com/package/minterjs

Install

npm i minterjs

Automatic delegation usage example

(async () => {
    const moment = require('moment');
    const {privateKey, address, publicKey, nodeHost} = process.env;
    const MinterJS = require('minterjs')({privateKey, host: nodeHost || 'http://minter.digriz.tech:8841'});
    const BIP = parseFloat((await MinterJS.balances({address})).find(balance => balance.coin == 'BIP').amount || '0');
    const min = 24 - parseInt(moment().format('H'));
    if(BIP > min){
        await MinterJS.delegate({stake: BIP - 0.7, publicKey});
    }
})();

Run in cron:

privateKey=BLA_BLA_BLA address=YOUR_ADDRESS_FOR_MONITORING publicKey=PUBLIC_KEY_OF_FAVORITE_NODE nodeHost=http://minter.digriz.tech:8841 node /redelegate/index.js

Done

const MinterJS = require('minterjs')({host, privateKey});
 
/** /address?address=_&height=_ */
MinterJS.address({address: 'Mx41b2cfc557dc4661a9526a5a3efcd2cc984339d1'});
 
/** /coin_info?symbol=_&height=_ */
MinterJS.coin_info({symbol: 'KARMA'});
 
/** /block?height=_ */
MinterJS.block({height: 1});
 
/** Peers from net_info */
MinterJS.peers();
 
/** Balances on address */
MinterJS.balances({address});
 
/** Delegate */
MinterJS.delegate({coinSymbol /** = BIP */, feeCoinSymbol /** = BIP */, stake, publicKey  /** default: minter.store */});
 
/** Delegations */ 
MinterJS.delegations({address /** optional */, coinToBuy /** optional, if yo want to get .totals and converted */});
 
/** Transactions */
MinterJS.transactions({address /** optional */, startblock /** optional */, endblock /** optional */, page /** optional */});
 
/** Estimations */
MinterJS.estimateCoinSell({coinToBuy/** optional, BIP default */, valueToSell, coinToSell});
 

Contacts

Donations

Mx41b2cfc557dc4661a9526a5a3efcd2cc984339d1

Minter node:

We launched node, please delegate:

Mp3df654b34c167443ef52e8644266866813b92d4a6ff9c0245c259750a199a455 (3% only)

Use node:

http://minter.digriz.tech:8841

Readme

Keywords

Package Sidebar

Install

npm i minterjs

Weekly Downloads

16

Version

0.5.0

License

MIT

Unpacked Size

8.9 kB

Total Files

4

Last publish

Collaborators

  • vvmspace