0.5.0 • Published 5 years ago

minterjs v0.5.0

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

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

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.2.0

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago