Add support for customizing all daemon api cmds
This commit is contained in:
@@ -5,6 +5,31 @@ The Exor block explorer.
|
||||
|
||||
This project is a fork of [Ciquidus Explorer](https://github.com/suprnurd/ciquidus) which is a fork of [Iquidus Explorer](https://github.com/iquidus/explorer). Shoutouts to both Luke Williams for the original code and Alan Rudolf for all the additional bonus featues which saved me tons of time! I'm only standing on the shoulders of giants. Thank you both!!!
|
||||
|
||||
### Features
|
||||
|
||||
- Custom rpc/api command support which increases blockchain compatibility. Supported cmds:
|
||||
- **getnetworkhashps:** Returns the estimated network hashes per second
|
||||
- **getmininginfo:** Returns a json object containing mining-related information
|
||||
- **getdifficulty:** Returns the proof-of-work difficulty as a multiple of the minimum difficulty
|
||||
- **getconnectioncount:** Returns the number of connections to other nodes
|
||||
- **getblockcount:** Returns the number of blocks in the longest blockchain
|
||||
- **getblockhash:** Returns hash of block in best-block-chain at height provided
|
||||
- **getblock:** Returns an object with information about the block
|
||||
- **getrawtransaction:** Returns raw transaction data
|
||||
- **getinfo:** Returns an object containing various state info
|
||||
- **gettxoutsetinfo:** Returns an object with statistics about the unspent transaction output set
|
||||
- **getsupply:** Returns the current money supply
|
||||
- **getmaxmoney:** Returns the number of coins that will be produced in total
|
||||
- **getmaxvote:** Returns the maximum allowed vote for the current phase of voting
|
||||
- **getvote:** Returns the current block reward vote setting
|
||||
- **getphase:** Returns the current voting phase name
|
||||
- **getreward:** Returns the current block reward
|
||||
- **getnextrewardestimate:** Returns an estimate for the next block reward based on the current state of decentralized voting
|
||||
- **getnextrewardwhenstr:** Returns a string describing how long until the votes are tallied and the next block reward is computed
|
||||
- **getvotelist:** Returns an object with details regarding the current vote list
|
||||
- **getmasternodecount:** Returns a json object containing the total number of masternodes on the network
|
||||
- **getmasternodelist:** Returns a json array containing status information for all masternodes on the network
|
||||
|
||||
### See it in action
|
||||
|
||||
- https://explorer.exor.io/
|
||||
|
||||
@@ -63,10 +63,10 @@ app.use(express.static(path.join(__dirname, 'public')));
|
||||
// routes
|
||||
app.use('/api', nodeapi.app);
|
||||
app.use('/', routes);
|
||||
app.use('/ext/getmoneysupply', function(req,res){
|
||||
lib.get_supply(function(supply){
|
||||
app.use('/ext/getmoneysupply', function(req,res) {
|
||||
lib.get_supply(function(supply) {
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.end(supply.toString());
|
||||
res.end((supply ? supply.toString() : '0'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,12 +119,12 @@ app.use('/ext/gettx/:txid', function(req, res) {
|
||||
db.get_tx(txid, function(tx) {
|
||||
if (tx) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
res.send({ active: 'tx', tx: tx, confirmations: settings.confirmations, blockcount: blockcount});
|
||||
res.send({ active: 'tx', tx: tx, confirmations: settings.confirmations, blockcount: (blockcount ? blockcount : 0)});
|
||||
});
|
||||
}
|
||||
else {
|
||||
lib.get_rawtransaction(txid, function(rtx) {
|
||||
if (rtx.txid) {
|
||||
if (rtx && rtx.txid) {
|
||||
lib.prepare_vin(rtx, function(vin) {
|
||||
lib.prepare_vout(rtx.vout, rtx.txid, vin, function(rvout, rvin) {
|
||||
lib.calculate_total(rvout, function(total){
|
||||
@@ -150,7 +150,7 @@ app.use('/ext/gettx/:txid', function(req, res) {
|
||||
blockindex: rtx.blockheight,
|
||||
};
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
res.send({ active: 'tx', tx: utx, confirmations: settings.confirmations, blockcount: blockcount});
|
||||
res.send({ active: 'tx', tx: utx, confirmations: settings.confirmations, blockcount: (blockcount ? blockcount : 0)});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -192,15 +192,15 @@ app.use('/ext/getcurrentprice', function(req,res){
|
||||
});
|
||||
});
|
||||
|
||||
app.use('/ext/getbasicstats', function(req,res){
|
||||
lib.get_blockcount(function(blockcount){
|
||||
lib.get_supply(function(supply){
|
||||
db.get_stats(settings.coin, function (stats){
|
||||
lib.get_masternodecount(function(masternodestotal){
|
||||
eval('var p_ext = { "block_count": blockcount, "money_supply": supply, "last_price_'+settings.markets.exchange.toLowerCase()+'": stats.last_price, "last_price_usd": stats.last_usd_price, "masternode_count": masternodestotal.total }');
|
||||
app.use('/ext/getbasicstats', function(req,res) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
lib.get_supply(function(supply) {
|
||||
db.get_stats(settings.coin, function (stats) {
|
||||
lib.get_masternodecount(function(masternodestotal) {
|
||||
eval('var p_ext = { "block_count": (blockcount ? blockcount : 0), "money_supply": (supply ? supply : 0), "last_price_'+settings.markets.exchange.toLowerCase()+'": stats.last_price, "last_price_usd": stats.last_usd_price, "masternode_count": masternodestotal.total }');
|
||||
res.send(p_ext);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -318,6 +318,7 @@ app.set('labels', settings.labels);
|
||||
app.set('homelink', settings.homelink);
|
||||
app.set('logoheight', settings.logoheight);
|
||||
app.set('burned_coins', settings.burned_coins);
|
||||
app.set('api_cmds', settings.api_cmds);
|
||||
|
||||
app.set('footer_height_desktop', settings.footer_height_desktop);
|
||||
app.set('footer_height_tablet', settings.footer_height_tablet);
|
||||
|
||||
+13
-13
@@ -116,7 +116,7 @@ function find_tx(txid, cb) {
|
||||
|
||||
function save_tx(txid, blockheight, cb) {
|
||||
lib.get_rawtransaction(txid, function(tx){
|
||||
if (tx != 'There was an error. Check your console.') {
|
||||
if (tx && tx != 'There was an error. Check your console.') {
|
||||
lib.prepare_vin(tx, function(vin) {
|
||||
lib.prepare_vout(tx.vout, txid, vin, ((typeof tx.vjoinsplit === 'undefined' || tx.vjoinsplit == null) ? [] : tx.vjoinsplit), function(vout, nvin) {
|
||||
lib.syncLoop(vin.length, function (loop) {
|
||||
@@ -680,14 +680,14 @@ module.exports = {
|
||||
}, function(){
|
||||
console.log(newVotes);
|
||||
Heavy.updateOne({coin: coin}, {
|
||||
lvote: vote,
|
||||
reward: reward,
|
||||
supply: supply,
|
||||
cap: maxmoney,
|
||||
estnext: estnext,
|
||||
phase: phase,
|
||||
maxvote: maxvote,
|
||||
nextin: nextin,
|
||||
lvote: (vote ? vote : 0),
|
||||
reward: (reward ? reward : 0),
|
||||
supply: (supply ? supply : 0),
|
||||
cap: (maxmoney ? maxmoney : 0),
|
||||
estnext: (estnext ? estnext : 0),
|
||||
phase: (phase ? phase : 'N/A'),
|
||||
maxvote: (maxvote ? maxvote : 0),
|
||||
nextin: (nextin ? nextin : 'N/A'),
|
||||
votes: newVotes,
|
||||
}, function() {
|
||||
//console.log('address updated: %s', hash);
|
||||
@@ -765,8 +765,8 @@ module.exports = {
|
||||
Stats.updateOne({coin: coin}, {
|
||||
coin: coin,
|
||||
count : count,
|
||||
supply: supply,
|
||||
connections: connections
|
||||
supply: (supply ? supply : 0),
|
||||
connections: (connections ? connections : 0)
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
console.log("Error during Stats Update: ", err);
|
||||
@@ -774,8 +774,8 @@ module.exports = {
|
||||
return cb({
|
||||
coin: coin,
|
||||
count : count,
|
||||
supply: supply,
|
||||
connections: connections,
|
||||
supply: (supply ? supply : 0),
|
||||
connections: (connections ? connections : 0),
|
||||
last: (stats.last ? stats.last : 0),
|
||||
txes: (stats.txes ? stats.txes : 0)
|
||||
});
|
||||
|
||||
+547
-244
@@ -29,6 +29,48 @@ function rpcCommand(params, cb) {
|
||||
});
|
||||
}
|
||||
|
||||
function prepareRpcCommand(cmd, addParams) {
|
||||
var method_name = '';
|
||||
var params = addParams || [];
|
||||
|
||||
// Check for null/blank string
|
||||
if (cmd != null && cmd.trim() != '') {
|
||||
// Split cmd by spaces
|
||||
var split = cmd.split(' ');
|
||||
|
||||
for (i=0; i<split.length; i++) {
|
||||
if (i==0)
|
||||
method_name = split[i];
|
||||
else
|
||||
params.push(split[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return { method: method_name, parameters: params };
|
||||
}
|
||||
|
||||
function convertHashUnits(hashes) {
|
||||
if (settings.nethash_units == 'K') {
|
||||
// return units in KH/s
|
||||
return (hashes / 1000).toFixed(4);
|
||||
} else if (settings.nethash_units == 'M') {
|
||||
// return units in MH/s
|
||||
return (hashes / 1000000).toFixed(4);
|
||||
} else if (settings.nethash_units == 'G') {
|
||||
// return units in GH/s
|
||||
return (hashes / 1000000000).toFixed(4);
|
||||
} else if (settings.nethash_units == 'T') {
|
||||
// return units in TH/s
|
||||
return (hashes / 1000000000000).toFixed(4);
|
||||
} else if (settings.nethash_units == 'P') {
|
||||
// return units in PH/s
|
||||
return (hashes / 1000000000000000).toFixed(4);
|
||||
} else {
|
||||
// return units in H/s
|
||||
return hashes.toFixed(4);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
convert_to_satoshi: function(amount, cb) {
|
||||
// fix to 8dp & convert to string
|
||||
@@ -38,290 +80,507 @@ module.exports = {
|
||||
},
|
||||
|
||||
get_hashrate: function(cb) {
|
||||
// check if hash rate should be hidden
|
||||
if (settings.index.show_hashrate == false) return cb('-');
|
||||
if (settings.use_rpc) {
|
||||
if (settings.nethash == 'netmhashps') {
|
||||
rpcCommand([{method:'getmininginfo', parameters: []}], function(response) {
|
||||
if (response == 'There was an error. Check your console.') { return cb(response);}
|
||||
if (response.netmhashps) {
|
||||
if (settings.nethash_units == 'K') {
|
||||
return cb((response.netmhashps * 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'G') {
|
||||
return cb((response.netmhashps / 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'H') {
|
||||
return cb((response.netmhashps * 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'T') {
|
||||
return cb((response.netmhashps / 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'P') {
|
||||
return cb((response.netmhashps / 1000000000).toFixed(4));
|
||||
} else {
|
||||
return cb(response.netmhashps.toFixed(4));
|
||||
}
|
||||
} else {
|
||||
return cb('-');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
rpcCommand([{method:'getnetworkhashps', parameters: []}], function(response) {
|
||||
if (response == 'There was an error. Check your console.') { return cb(response);}
|
||||
if (response) {
|
||||
if (settings.nethash_units == 'K') {
|
||||
return cb((response / 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'M'){
|
||||
return cb((response / 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'G') {
|
||||
return cb((response / 1000000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'T') {
|
||||
return cb((response / 1000000000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'P') {
|
||||
return cb((response / 1000000000000000).toFixed(4));
|
||||
} else {
|
||||
return cb(response.toFixed(4));
|
||||
}
|
||||
// check how to acquire network hashrate
|
||||
if (settings.nethash == 'netmhashps') {
|
||||
// load getmininginfo rpc call from settings
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getmininginfo);
|
||||
// check if the rpc cmd is valid
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
// check if getting data from wallet rpc or web api request
|
||||
if (settings.use_rpc) {
|
||||
// get data from wallet via rpc cmd
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.') return cb('-');
|
||||
|
||||
var net_hash = null;
|
||||
// check for different implementations of the net has value
|
||||
if (response.netmhashps) {
|
||||
// value returned in MH/s so convert to H/s
|
||||
net_hash = (response.netmhashps * 1000000);
|
||||
} else if (response.networkhashps)
|
||||
net_hash = response.networkhashps;
|
||||
else if (response.hashespersec)
|
||||
net_hash = response.hashespersec;
|
||||
|
||||
// check if netmhashps has a value
|
||||
if (net_hash) {
|
||||
// return hash value with proper units
|
||||
return cb(convertHashUnits(net_hash));
|
||||
} else {
|
||||
// netmhashps is blank/null
|
||||
return cb('-');
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if (settings.nethash == 'netmhashps') {
|
||||
var uri = base_url + 'getmininginfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) { //returned in mhash
|
||||
if (body.netmhashps) {
|
||||
if (settings.nethash_units == 'K') {
|
||||
return cb((body.netmhashps * 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'G') {
|
||||
return cb((body.netmhashps / 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'H') {
|
||||
return cb((body.netmhashps * 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'T') {
|
||||
return cb((body.netmhashps / 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'P') {
|
||||
return cb((body.netmhashps / 1000000000).toFixed(4));
|
||||
});
|
||||
} else {
|
||||
// get data via internal web api request
|
||||
var uri = base_url + 'getmininginfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.') {
|
||||
// return a blank value
|
||||
return cb('-');
|
||||
} else {
|
||||
return cb(body.netmhashps.toFixed(4));
|
||||
var net_hash = null;
|
||||
// check for different implementations of the net has value
|
||||
if (body.netmhashps) {
|
||||
// value returned in MH/s so convert to H/s
|
||||
net_hash = (body.netmhashps * 1000000);
|
||||
} else if (body.networkhashps)
|
||||
net_hash = body.networkhashps;
|
||||
else if (body.hashespersec)
|
||||
net_hash = body.hashespersec;
|
||||
|
||||
// check if there is a net hash value
|
||||
if (net_hash) {
|
||||
// return hash value with proper units
|
||||
return cb(convertHashUnits(net_hash));
|
||||
} else {
|
||||
// netmhashps is blank/null
|
||||
return cb('-');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return cb('-');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getnetworkhashps';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
if (body == 'There was an error. Check your console.') {
|
||||
return cb('-');
|
||||
} else {
|
||||
if (settings.nethash_units == 'K') {
|
||||
return cb((body / 1000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'M'){
|
||||
return cb((body / 1000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'G') {
|
||||
return cb((body / 1000000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'T') {
|
||||
return cb((body / 1000000000000).toFixed(4));
|
||||
} else if (settings.nethash_units == 'P') {
|
||||
return cb((body / 1000000000000000).toFixed(4));
|
||||
} else {
|
||||
return cb((body).toFixed(4));
|
||||
}
|
||||
}
|
||||
});
|
||||
// getmininginfo cmd not set
|
||||
return cb('-');
|
||||
}
|
||||
} else if (settings.nethash == 'getnetworkhashps') {
|
||||
// load getnetworkhashps rpc call from settings
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getnetworkhashps);
|
||||
// check if the rpc cmd is valid
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
// check if getting data from wallet rpc or web api request
|
||||
if (settings.use_rpc) {
|
||||
// get data from wallet via rpc cmd
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.') return cb('-');
|
||||
// check if the response has a value
|
||||
if (response) {
|
||||
// return hash value with proper units
|
||||
return cb(convertHashUnits(response));
|
||||
} else {
|
||||
// response is blank/null
|
||||
return cb('-');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// get data via internal web api request
|
||||
var uri = base_url + 'getnetworkhashps';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.') {
|
||||
// return a blank value
|
||||
return cb('-');
|
||||
} else {
|
||||
// return hash value with proper units
|
||||
return cb(convertHashUnits(body));
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// getnetworkhashps cmd not set
|
||||
return cb('-');
|
||||
}
|
||||
} else {
|
||||
// Invalid network hashrate setting value
|
||||
return cb('-');
|
||||
}
|
||||
},
|
||||
|
||||
get_difficulty: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getdifficulty', parameters: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getdifficulty);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getdifficulty';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getdifficulty';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_connectioncount: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getconnectioncount', parameters: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getconnectioncount);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getconnectioncount';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getconnectioncount';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_masternodecount: function(cb) {
|
||||
if (settings.api_cmds.masternode_count != '') {
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getmasternodecount);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
// split cmd by spaces
|
||||
var split = settings.api_cmds.masternode_count.split(' ');
|
||||
var method_name = '';
|
||||
var params = [];
|
||||
for (i=0; i<split.length; i++) {
|
||||
if (i==0)
|
||||
method_name = split[i];
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
params.push(split[i]);
|
||||
}
|
||||
rpcCommand([{method:method_name, parameters: params}], function(response) {
|
||||
return cb(response);
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getmasternodecount';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else
|
||||
return cb({"total":0,"enabled":0});
|
||||
} else {
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_blockcount: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getblockcount', parameters: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getblockcount);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getblockcount';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getblockcount';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_blockhash: function(height, cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getblockhash', parameters: [parseInt(height)]}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getblockhash, (height ? [parseInt(height)] : []));
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getblockhash?height=' + (height ? height : '');
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getblockhash?height=' + height;
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_block: function(hash, cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getblock', parameters: [hash]}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getblock, (hash ? [hash] : []));
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getblock?hash=' + hash;
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getblock?hash=' + hash;
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_rawtransaction: function(hash, cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getrawtransaction', parameters: [hash, 1]}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getrawtransaction, (hash ? [hash, 1] : []));
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getrawtransaction?txid=' + hash + '&decrypt=1';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getrawtransaction?txid=' + hash + '&decrypt=1';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_maxmoney: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getmaxmoney', parameters: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getmaxmoney);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getmaxmoney';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getmaxmoney';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_maxvote: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getmaxvote', parameters: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getmaxvote);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getmaxvote';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getmaxvote';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_vote: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getvote', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getvote);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getvote';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getvote';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_phase: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getphase', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getphase);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getphase';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getphase';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_reward: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getreward', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getreward);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getreward';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getreward';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_estnext: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getnextrewardestimate', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getnextrewardestimate);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getnextrewardestimate';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getnextrewardestimate';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
get_nextin: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:'getnextrewardwhenstr', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getnextrewardwhenstr);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getnextrewardwhenstr';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var uri = base_url + 'getnextrewardwhenstr';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -381,53 +640,97 @@ module.exports = {
|
||||
},
|
||||
|
||||
get_supply: function(cb) {
|
||||
if (settings.use_rpc) {
|
||||
if ( settings.supply == 'HEAVY' ) {
|
||||
rpcCommand([{method:'getsupply', params: []}], function(response) {
|
||||
return cb(response);
|
||||
});
|
||||
} else if (settings.supply == 'GETINFO') {
|
||||
rpcCommand([{method:'getinfo', params: []}], function(response) {
|
||||
return cb(response.moneysupply);
|
||||
});
|
||||
} else if (settings.supply == 'BALANCES') {
|
||||
module.exports.balance_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
} else if (settings.supply == 'TXOUTSET') {
|
||||
rpcCommand([{method:'gettxoutsetinfo', params: []}], function(response) {
|
||||
return cb(response.total_amount);
|
||||
});
|
||||
if (settings.supply == 'HEAVY') {
|
||||
// attempt to get the supply from the getsupply or similar api cmd that returns the current money supply as a single positive decimal value
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getsupply);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getsupply';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
coinbase_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
} else if (settings.supply == 'GETINFO') {
|
||||
// attempt to get the supply from the getinfo or similar api cmd that returns and object containing various state info. Must include a value called "moneysupply" which represents the current running total of coins
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getinfo);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (!response || !response.moneysupply || response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response.moneysupply);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'getinfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (!body || !body.moneysupply ||body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body.moneysupply);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
} else if (settings.supply == 'BALANCES') {
|
||||
// get the supply by running a query on the addresses collection and summing up all positive balances (potentially a long running query for blockchains with tons of addresses)
|
||||
module.exports.balance_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
} else if (settings.supply == 'TXOUTSET') {
|
||||
// attempt to get the supply from the gettxoutsetinfo or similar api cmd that returns an object with statistics about the unspent transaction output set. Must include a value called "total_amount" which represents the current running total of coins
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.gettxoutsetinfo);
|
||||
|
||||
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
|
||||
if (settings.use_rpc) {
|
||||
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
|
||||
// check if an error msg was received from the rpc server
|
||||
if (!response || !response.total_amount || response == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(response.total_amount);
|
||||
});
|
||||
} else {
|
||||
var uri = base_url + 'gettxoutsetinfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
// check if an error msg was received from the web api server
|
||||
if (!body || !body.total_amount ||body == 'There was an error. Check your console.')
|
||||
return cb(null);
|
||||
else
|
||||
return cb(body.total_amount);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// cmd not in use. return null.
|
||||
return cb(null);
|
||||
}
|
||||
} else {
|
||||
if ( settings.supply == 'HEAVY' ) {
|
||||
var uri = base_url + 'getsupply';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body);
|
||||
});
|
||||
} else if (settings.supply == 'GETINFO') {
|
||||
var uri = base_url + 'getinfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body.moneysupply);
|
||||
});
|
||||
} else if (settings.supply == 'BALANCES') {
|
||||
module.exports.balance_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
} else if (settings.supply == 'TXOUTSET') {
|
||||
var uri = base_url + 'gettxoutsetinfo';
|
||||
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
|
||||
return cb(body.total_amount);
|
||||
});
|
||||
} else {
|
||||
coinbase_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
}
|
||||
// returns coinbase total sent as current coin supply
|
||||
coinbase_supply(function(supply) {
|
||||
return cb(supply/100000000);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
+1
-2
@@ -89,9 +89,8 @@ exports.api_calls = "API Calls",
|
||||
exports.api_getnetworkhashps = "Returns the current network hashrate. (hash/s)",
|
||||
exports.api_getdifficulty = "Returns the current difficulty.",
|
||||
exports.api_getconnectioncount = "Returns the number of connections the block explorer has to other nodes.",
|
||||
exports.api_getmasternodelist = "Returns the complete master node list.",
|
||||
exports.api_getmasternodelist = "Returns the complete list of masternodes on the network.",
|
||||
exports.api_getmasternodecount = "Returns the total number of masternodes on the network.",
|
||||
exports.api_getmasternodecountonline = "Returns the number of masternodes on the network that are currently online.",
|
||||
exports.api_getvotelist = "Returns the current vote list.",
|
||||
exports.api_getblockcount = "Returns the number of blocks currently in the block chain.",
|
||||
exports.api_getblockhash = "Returns the hash of the block at ; index 0 is the genesis block.",
|
||||
|
||||
+121
-52
@@ -29,19 +29,38 @@ module.exports = function(){
|
||||
|
||||
var command = [];
|
||||
|
||||
if (method == 'sendmany' ||
|
||||
method == 'getmasternodecountonline' ||
|
||||
method == 'getmasternodecount' ||
|
||||
method == 'getmasternodelist' ||
|
||||
method == 'getvotelist') {
|
||||
command = specialApiCase(method);
|
||||
} else if (method == 'verifymessage') {
|
||||
command = specialApiCase(method, query_parameters);
|
||||
} else {
|
||||
command = [{
|
||||
method: method,
|
||||
params: params
|
||||
}];
|
||||
switch (method) {
|
||||
case 'getnetworkhashps':
|
||||
case 'getmininginfo':
|
||||
case 'getdifficulty':
|
||||
case 'getconnectioncount':
|
||||
case 'getblockcount':
|
||||
case 'getblockhash':
|
||||
case 'getblock':
|
||||
case 'getrawtransaction':
|
||||
case 'getsupply':
|
||||
case 'getinfo':
|
||||
case 'gettxoutsetinfo':
|
||||
case 'getmaxmoney':
|
||||
case 'getmaxvote':
|
||||
case 'getvote':
|
||||
case 'getphase':
|
||||
case 'getreward':
|
||||
case 'getnextrewardestimate':
|
||||
case 'getnextrewardwhenstr':
|
||||
case 'getvotelist':
|
||||
case 'getmasternodecount':
|
||||
case 'getmasternodelist':
|
||||
case 'verifymessage':
|
||||
case 'sendmany':
|
||||
command = specialApiCase(method, query_parameters);
|
||||
break;
|
||||
default:
|
||||
command = [{
|
||||
method: method,
|
||||
params: params
|
||||
}];
|
||||
break;
|
||||
}
|
||||
|
||||
client.cmd(command, function(err, response){
|
||||
@@ -75,11 +94,99 @@ module.exports = function(){
|
||||
else res.end('This method is restricted.');
|
||||
}
|
||||
}
|
||||
|
||||
function prepareRpcCommand(cmd, addParams) {
|
||||
var method_name = '';
|
||||
var params = addParams || [];
|
||||
|
||||
// Check for null/blank string
|
||||
if (cmd != null && cmd.trim() != '') {
|
||||
// Split cmd by spaces
|
||||
var split = cmd.split(' ');
|
||||
|
||||
for (i=0; i<split.length; i++) {
|
||||
if (i==0)
|
||||
method_name = split[i];
|
||||
else
|
||||
params.push(split[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return { method: method_name, parameters: params };
|
||||
}
|
||||
|
||||
function specialApiCase(method_name, query_parameters){
|
||||
var params = [];
|
||||
|
||||
switch(method_name) {
|
||||
switch (method_name) {
|
||||
case 'getnetworkhashps':
|
||||
case 'getmininginfo':
|
||||
case 'getdifficulty':
|
||||
case 'getconnectioncount':
|
||||
case 'getblockcount':
|
||||
case 'getsupply':
|
||||
case 'getinfo':
|
||||
case 'gettxoutsetinfo':
|
||||
case 'getmaxmoney':
|
||||
case 'getmaxvote':
|
||||
case 'getvote':
|
||||
case 'getphase':
|
||||
case 'getreward':
|
||||
case 'getnextrewardestimate':
|
||||
case 'getnextrewardwhenstr':
|
||||
case 'getvotelist':
|
||||
case 'getmasternodecount':
|
||||
case 'getmasternodelist':
|
||||
var cmd = prepareRpcCommand(settings.api_cmds[method_name]);
|
||||
method_name = cmd.method;
|
||||
params = cmd.parameters;
|
||||
break;
|
||||
case 'getblockhash':
|
||||
for (var parameter in query_parameters) {
|
||||
if (query_parameters.hasOwnProperty(parameter) && (parameter == 'height' || parameter == 'index'))
|
||||
params.push(parseInt(query_parameters[parameter]));
|
||||
}
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getblockhash, params);
|
||||
method_name = cmd.method;
|
||||
params = cmd.parameters;
|
||||
break;
|
||||
case 'getblock':
|
||||
for (var parameter in query_parameters) {
|
||||
if (query_parameters.hasOwnProperty(parameter) && parameter == 'hash')
|
||||
params.push(query_parameters[parameter]);
|
||||
}
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getblock, params);
|
||||
method_name = cmd.method;
|
||||
params = cmd.parameters;
|
||||
break;
|
||||
case 'getrawtransaction':
|
||||
for (var parameter in query_parameters) {
|
||||
if (query_parameters.hasOwnProperty(parameter)) {
|
||||
if (parameter == 'txid')
|
||||
params.push(query_parameters[parameter]);
|
||||
else if (parameter == 'decrypt')
|
||||
params.push(parseInt(query_parameters[parameter]));
|
||||
}
|
||||
}
|
||||
var cmd = prepareRpcCommand(settings.api_cmds.getrawtransaction, params);
|
||||
method_name = cmd.method;
|
||||
params = cmd.parameters;
|
||||
break;
|
||||
case 'verifymessage':
|
||||
for (var parameter in query_parameters) {
|
||||
if (query_parameters.hasOwnProperty(parameter)) {
|
||||
if (parameter == 'address' || parameter == 'message')
|
||||
params.push(query_parameters[parameter]);
|
||||
if (parameter == 'signature') {
|
||||
var param = decodeURIComponent(query_parameters[parameter]);
|
||||
while (param.indexOf(" ") > -1) {
|
||||
param = param.replace(" ", "+");
|
||||
}
|
||||
params.push(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'sendmany':
|
||||
var after_account = false;
|
||||
var before_min_conf = true;
|
||||
@@ -107,44 +214,6 @@ module.exports = function(){
|
||||
params.push(address_info);
|
||||
}
|
||||
break;
|
||||
case 'getvotelist':
|
||||
method_name = 'masternodelist'
|
||||
params.push('votes');
|
||||
break;
|
||||
case 'getmasternodelist':
|
||||
method_name = 'masternode'
|
||||
params.push('list');
|
||||
break;
|
||||
case 'getmasternodecountonline':
|
||||
method_name = 'masternode';
|
||||
params.push('count');
|
||||
params.push('enabled');
|
||||
break;
|
||||
case 'getmasternodecount':
|
||||
// split cmd by spaces
|
||||
var sSplit = settings.api_cmds.masternode_count.split(' ');
|
||||
for (i=0; i<sSplit.length; i++) {
|
||||
if (i==0)
|
||||
method_name = sSplit[i];
|
||||
else
|
||||
params.push(sSplit[i]);
|
||||
}
|
||||
break;
|
||||
case 'verifymessage':
|
||||
for (var parameter in query_parameters) {
|
||||
if (query_parameters.hasOwnProperty(parameter)) {
|
||||
if (parameter == 'address' || parameter == 'message')
|
||||
params.push(query_parameters[parameter]);
|
||||
if (parameter == 'signature') {
|
||||
var param = decodeURIComponent(query_parameters[parameter]);
|
||||
while (param.indexOf(" ") > -1) {
|
||||
param = param.replace(" ", "+");
|
||||
}
|
||||
params.push(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return [{
|
||||
|
||||
+21
-1
@@ -178,7 +178,27 @@ exports.burned_coins = [];
|
||||
|
||||
// Customized API commands
|
||||
exports.api_cmds = {
|
||||
"masternode_count": "getmasternodecount"
|
||||
"getnetworkhashps": "getnetworkhashps",
|
||||
"getmininginfo": "getmininginfo",
|
||||
"getdifficulty": "getdifficulty",
|
||||
"getconnectioncount": "getconnectioncount",
|
||||
"getblockcount": "getblockcount",
|
||||
"getblockhash": "getblockhash",
|
||||
"getblock": "getblock",
|
||||
"getrawtransaction": "getrawtransaction",
|
||||
"getinfo": "getinfo",
|
||||
"gettxoutsetinfo": "gettxoutsetinfo",
|
||||
"getsupply": "getsupply",
|
||||
"getmaxmoney": "getmaxmoney",
|
||||
"getmaxvote": "getmaxvote",
|
||||
"getvote": "getvote",
|
||||
"getphase": "getphase",
|
||||
"getreward": "getreward",
|
||||
"getnextrewardestimate": "getnextrewardestimate",
|
||||
"getnextrewardwhenstr": "getnextrewardwhenstr",
|
||||
"getvotelist": "masternodelist votes",
|
||||
"getmasternodecount": "getmasternodecount",
|
||||
"getmasternodelist": "listmasternodes"
|
||||
};
|
||||
|
||||
exports.reloadSettings = function reloadSettings() {
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@
|
||||
"api_getnetworkhashps": "Returns the current network hashrate. (hash/s)",
|
||||
"api_getdifficulty": "Returns the current difficulty.",
|
||||
"api_getconnectioncount": "Returns the number of connections the block explorer has to other nodes.",
|
||||
"api_getmasternodelist": "Returns the complete master node list.",
|
||||
"api_getmasternodelist": "Returns the complete list of masternodes on the network.",
|
||||
"api_getmasternodecount": "Returns the total number of masternodes on the network.",
|
||||
"api_getvotelist": "Returns the current vote list.",
|
||||
"api_getblockcount": "Returns the current block index.",
|
||||
|
||||
+23
-14
@@ -8,7 +8,7 @@ var express = require('express')
|
||||
|
||||
function route_get_block(res, blockhash) {
|
||||
lib.get_block(blockhash, function (block) {
|
||||
if (block != 'There was an error. Check your console.') {
|
||||
if (block && block != 'There was an error. Check your console.') {
|
||||
if (blockhash == settings.genesis_block) {
|
||||
res.render('block', { active: 'block', block: block, confirmations: settings.confirmations, txs: 'GENESIS', showSync: db.check_show_sync_message()});
|
||||
} else {
|
||||
@@ -32,7 +32,7 @@ function route_get_block(res, blockhash) {
|
||||
if (!isNaN(blockhash)) {
|
||||
var height = blockhash;
|
||||
lib.get_blockhash(height, function(hash) {
|
||||
if (hash != 'There was an error. Check your console.') {
|
||||
if (hash && hash != 'There was an error. Check your console.') {
|
||||
res.redirect('/block/' + hash);
|
||||
} else {
|
||||
route_get_index(res, 'Block not found: ' + blockhash);
|
||||
@@ -53,12 +53,12 @@ function route_get_tx(res, txid) {
|
||||
db.get_tx(txid, function(tx) {
|
||||
if (tx) {
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.confirmations, blockcount: blockcount, showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: tx, confirmations: settings.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
});
|
||||
}
|
||||
else {
|
||||
lib.get_rawtransaction(txid, function(rtx) {
|
||||
if (rtx.txid) {
|
||||
if (rtx && rtx.txid) {
|
||||
lib.prepare_vin(rtx, function(vin) {
|
||||
lib.prepare_vout(rtx.vout, rtx.txid, vin, ((typeof rtx.vjoinsplit === 'undefined' || rtx.vjoinsplit == null) ? [] : rtx.vjoinsplit), function(rvout, rvin) {
|
||||
lib.calculate_total(rvout, function(total){
|
||||
@@ -84,7 +84,7 @@ function route_get_tx(res, txid) {
|
||||
blockindex: rtx.blockheight,
|
||||
};
|
||||
lib.get_blockcount(function(blockcount) {
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.confirmations, blockcount: blockcount, showSync: db.check_show_sync_message()});
|
||||
res.render('tx', { active: 'tx', tx: utx, confirmations: settings.confirmations, blockcount: (blockcount ? blockcount : 0), showSync: db.check_show_sync_message()});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -256,7 +256,7 @@ router.post('/search', function(req, res) {
|
||||
res.redirect('/tx/' +tx.txid);
|
||||
} else {
|
||||
lib.get_block(query, function(block) {
|
||||
if (block != 'There was an error. Check your console.') {
|
||||
if (block && block != 'There was an error. Check your console.') {
|
||||
res.redirect('/block/' + query);
|
||||
} else {
|
||||
route_get_index(res, locale.ex_search_error + query );
|
||||
@@ -271,7 +271,7 @@ router.post('/search', function(req, res) {
|
||||
res.redirect('/address/' + address.a_id);
|
||||
} else {
|
||||
lib.get_blockhash(query, function(hash) {
|
||||
if (hash != 'There was an error. Check your console.') {
|
||||
if (hash && hash != 'There was an error. Check your console.') {
|
||||
res.redirect('/block/' + hash);
|
||||
} else {
|
||||
route_get_index(res, locale.ex_search_error + query );
|
||||
@@ -298,7 +298,7 @@ router.get('/qr/:string', function(req, res) {
|
||||
router.get('/ext/summary', function(req, res) {
|
||||
lib.get_difficulty(function(difficulty) {
|
||||
difficultyHybrid = '';
|
||||
if (difficulty['proof-of-work']) {
|
||||
if (difficulty && difficulty['proof-of-work']) {
|
||||
if (settings.index.difficulty == 'Hybrid') {
|
||||
difficultyHybrid = 'POS: ' + difficulty['proof-of-stake'];
|
||||
difficulty = 'POW: ' + difficulty['proof-of-work'];
|
||||
@@ -316,17 +316,26 @@ router.get('/ext/summary', function(req, res) {
|
||||
if (hashrate == 'There was an error. Check your console.') {
|
||||
hashrate = 0;
|
||||
}
|
||||
var masternodesoffline = Math.floor(masternodestotal.total - masternodestotal.enabled);
|
||||
|
||||
var mn_total = 0;
|
||||
var mn_enabled = 0;
|
||||
|
||||
if (masternodestotal) {
|
||||
if (masternodestotal.total)
|
||||
mn_total = masternodestotal.total;
|
||||
if (masternodestotal.enabled)
|
||||
mn_enabled = masternodestotal.enabled;
|
||||
}
|
||||
res.send({ data: [{
|
||||
difficulty: difficulty,
|
||||
difficulty: (difficulty ? difficulty : '-'),
|
||||
difficultyHybrid: difficultyHybrid,
|
||||
supply: (stats == null || stats.supply == null ? 0 : stats.supply),
|
||||
hashrate: hashrate,
|
||||
lastPrice: (stats == null || stats.last_price == null ? 0 : stats.last_price),
|
||||
connections: connections,
|
||||
masternodeCountOnline: masternodestotal.enabled,
|
||||
masternodeCountOffline: masternodesoffline,
|
||||
blockcount: blockcount
|
||||
connections: (connections ? connections : '-'),
|
||||
masternodeCountOnline: (masternodestotal ? mn_enabled : '-'),
|
||||
masternodeCountOffline: (masternodestotal ? Math.floor(mn_total - mn_enabled) : '-'),
|
||||
blockcount: (blockcount ? blockcount : '-')
|
||||
}]});
|
||||
});
|
||||
});
|
||||
|
||||
+47
-6
@@ -204,8 +204,8 @@
|
||||
// netmhashps: uses getmininginfo.netmhashpsm returns in MH/s
|
||||
"nethash": "getnetworkhashps",
|
||||
|
||||
// nethash unitd: sets nethash API return units
|
||||
// valid options: "P" (PH/s), "T" (TH/s), "G" (GH/s), "M" (MH/s), "K" (KH/s)
|
||||
// nethash_units: sets nethash API return units
|
||||
// valid options: "P" (PH/s), "T" (TH/s), "G" (GH/s), "M" (MH/s), "K" (KH/s), "H" (H/s)
|
||||
"nethash_units": "G",
|
||||
|
||||
// simple Cross-Origin Resource Sharing (CORS) support
|
||||
@@ -239,12 +239,53 @@
|
||||
"burned_coins": [],
|
||||
|
||||
// Customized API commands
|
||||
// Not all blockchains utilize the same rpc cmds for accessing the internal daemon api
|
||||
// Leave the value blank for any cmd that should not be used
|
||||
// Not all blockchains utilize the same rpc cmds for accessing the internal daemon api.
|
||||
// Leaving a cmd value blank ( "" ) will completely disable use of that cmd.
|
||||
// NOTICE: Some apis such as getblockhash for example, are integral to the functionality of the explorer and will result in a fairly unusable experience if disabled.
|
||||
// The following cmd-line calls to the daemon can be overridden:
|
||||
//
|
||||
// masternode_count: This should return an array of masternode counts where one key in the array must be named "total" and one key must be named "enabled" which are used to determine how many masternodes are offline (not enabled)
|
||||
// getnetworkhashps: Returns the estimated network hashes per second. This should be a positive whole number.
|
||||
// getmininginfo: Returns a json object containing mining-related information.
|
||||
// getdifficulty: Returns the proof-of-work difficulty as a multiple of the minimum difficulty. This should be a positive whole or decimal number.
|
||||
// getconnectioncount: Returns the number of connections to other nodes. This should be a positive whole number.
|
||||
// getblockcount: Returns the number of blocks in the longest blockchain. This should be a positive whole number.
|
||||
// getblockhash: Returns hash of block in best-block-chain at height provided. This should be a string value.
|
||||
// getblock: Returns an object with information about the block.
|
||||
// getrawtransaction: Returns raw transaction data. Can return a hex-encoded string that is serialized or an object with txid information depending on the decrypt value (0(false) or 1(true))
|
||||
// getinfo: Returns an object containing various state info.
|
||||
// gettxoutsetinfo: Returns an object with statistics about the unspent transaction output set.
|
||||
// getsupply: Returns the current money supply. This should be a positive whole or decimal number.
|
||||
// getmaxmoney: Returns the number of coins that will be produced in total. This should be a positive whole or decimal number.
|
||||
// getmaxvote: Returns the maximum allowed vote for the current phase of voting. This should be a positive whole number.
|
||||
// getvote: Returns the current block reward vote setting. This should be a positive whole number.
|
||||
// getphase: Returns the current voting phase name. This should be a string value.
|
||||
// getreward: Returns the current block reward. This should be a positive whole or decimal number.
|
||||
// getnextrewardestimate: Returns an estimate for the next block reward based on the current state of decentralized voting. This should be a positive whole or decimal number.
|
||||
// getnextrewardwhenstr: Returns a string describing how long until the votes are tallied and the next block reward is computed.
|
||||
// getvotelist: Returns an object with details regarding the current vote list.
|
||||
// getmasternodecount: Returns a json object containing the total number of masternodes on the network.
|
||||
// getmasternodelist: Returns a json array containing status information for all masternodes on the network.
|
||||
"api_cmds": {
|
||||
"masternode_count": "getmasternodecount"
|
||||
"getnetworkhashps": "getnetworkhashps",
|
||||
"getmininginfo": "getmininginfo",
|
||||
"getdifficulty": "getdifficulty",
|
||||
"getconnectioncount": "getconnectioncount",
|
||||
"getblockcount": "getblockcount",
|
||||
"getblockhash": "getblockhash",
|
||||
"getblock": "getblock",
|
||||
"getrawtransaction": "getrawtransaction",
|
||||
"getinfo": "getinfo",
|
||||
"gettxoutsetinfo": "gettxoutsetinfo",
|
||||
"getsupply": "getsupply",
|
||||
"getmaxmoney": "getmaxmoney",
|
||||
"getmaxvote": "getmaxvote",
|
||||
"getvote": "getvote",
|
||||
"getphase": "getphase",
|
||||
"getreward": "getreward",
|
||||
"getnextrewardestimate": "getnextrewardestimate",
|
||||
"getnextrewardwhenstr": "getnextrewardwhenstr",
|
||||
"getvotelist": "masternodelist votes",
|
||||
"getmasternodecount": "getmasternodecount",
|
||||
"getmasternodelist": "listmasternodes"
|
||||
}
|
||||
}
|
||||
+123
-94
@@ -14,107 +14,136 @@ block content
|
||||
p
|
||||
em Return data from coind
|
||||
ul
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getdifficulty
|
||||
div
|
||||
em #{settings.locale.api_getdifficulty}
|
||||
a(href='/api/getdifficulty') #{address}/api/getdifficulty
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getconnectioncount
|
||||
div
|
||||
em #{settings.locale.api_getconnectioncount}
|
||||
a(href='/api/getconnectioncount') #{address}/api/getconnectioncount
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmasternodecount
|
||||
div
|
||||
em #{settings.locale.api_getmasternodecount}
|
||||
a(href='/api/getmasternodecount') #{address}/api/getmasternodecount
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblockcount
|
||||
div
|
||||
em #{settings.locale.api_getblockcount}
|
||||
a(href='/api/getblockcount') #{address}/api/getblockcount
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblockhash [index]
|
||||
div
|
||||
em #{settings.locale.api_getblockhash}
|
||||
a(href='/api/getblockhash?index=' + hashes.blockindex) #{address}/api/getblockhash?index=#{hashes.blockindex}
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblock [hash]
|
||||
div
|
||||
em #{settings.locale.api_getblock}
|
||||
a(href='/api/getblock?hash=' + hashes.blockhash) #{address}/api/getblock?hash=#{hashes.blockhash}
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getrawtransaction [txid] [decrypt]
|
||||
div
|
||||
em #{settings.locale.api_getrawtransaction}
|
||||
div
|
||||
a(href='/api/getrawtransaction?txid=' + hashes.txhash + '&decrypt=0') #{address}/api/getrawtransaction?txid=#{hashes.txhash}&decrypt=0
|
||||
div
|
||||
a(href='/api/getrawtransaction?txid=' + hashes.txhash + '&decrypt=1') #{address}/api/getrawtransaction?txid=#{hashes.txhash}&decrypt=1
|
||||
if settings.index.show_hashrate == true
|
||||
if settings.api_cmds['getdifficulty'] != null && settings.api_cmds['getdifficulty'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getdifficulty
|
||||
div
|
||||
em #{settings.locale.api_getdifficulty}
|
||||
a(href='/api/getdifficulty') #{address}/api/getdifficulty
|
||||
if settings.api_cmds['getconnectioncount'] != null && settings.api_cmds['getconnectioncount'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getconnectioncount
|
||||
div
|
||||
em #{settings.locale.api_getconnectioncount}
|
||||
a(href='/api/getconnectioncount') #{address}/api/getconnectioncount
|
||||
if settings.api_cmds['getblockcount'] != null && settings.api_cmds['getblockcount'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblockcount
|
||||
div
|
||||
em #{settings.locale.api_getblockcount}
|
||||
a(href='/api/getblockcount') #{address}/api/getblockcount
|
||||
if settings.api_cmds['getblockhash'] != null && settings.api_cmds['getblockhash'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblockhash [index]
|
||||
div
|
||||
em #{settings.locale.api_getblockhash}
|
||||
a(href='/api/getblockhash?index=' + hashes.blockindex) #{address}/api/getblockhash?index=#{hashes.blockindex}
|
||||
if settings.api_cmds['getblock'] != null && settings.api_cmds['getblock'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getblock [hash]
|
||||
div
|
||||
em #{settings.locale.api_getblock}
|
||||
a(href='/api/getblock?hash=' + hashes.blockhash) #{address}/api/getblock?hash=#{hashes.blockhash}
|
||||
if settings.api_cmds['getrawtransaction'] != null && settings.api_cmds['getrawtransaction'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getrawtransaction [txid] [decrypt]
|
||||
div
|
||||
em #{settings.locale.api_getrawtransaction}
|
||||
div
|
||||
a(href='/api/getrawtransaction?txid=' + hashes.txhash + '&decrypt=0') #{address}/api/getrawtransaction?txid=#{hashes.txhash}&decrypt=0
|
||||
div
|
||||
a(href='/api/getrawtransaction?txid=' + hashes.txhash + '&decrypt=1') #{address}/api/getrawtransaction?txid=#{hashes.txhash}&decrypt=1
|
||||
if settings.index.show_hashrate == true && settings.api_cmds['getnetworkhashps'] != null && settings.api_cmds['getnetworkhashps'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getnetworkhashps
|
||||
div
|
||||
em #{settings.locale.api_getnetworkhashps}
|
||||
a(href='/api/getnetworkhashps') #{address}/api/getnetworkhashps
|
||||
if settings.api_cmds['getvotelist'] != null && settings.api_cmds['getvotelist'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getvotelist
|
||||
div
|
||||
em #{settings.locale.api_getvotelist}
|
||||
a(href='/api/getvotelist') #{address}/api/getvotelist
|
||||
if settings.api_cmds['getmasternodecount'] != null && settings.api_cmds['getmasternodecount'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmasternodecount
|
||||
div
|
||||
em #{settings.locale.api_getmasternodecount}
|
||||
a(href='/api/getmasternodecount') #{address}/api/getmasternodecount
|
||||
if settings.api_cmds['getmasternodelist'] != null && settings.api_cmds['getmasternodelist'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmasternodelist
|
||||
div
|
||||
em #{settings.locale.api_getmasternodelist}
|
||||
a(href='/api/getmasternodelist') #{address}/api/getmasternodelist
|
||||
if settings.heavy == true
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmaxmoney
|
||||
div
|
||||
em #{settings.locale.api_getmaxmoney}
|
||||
a(href='/api/getmaxmoney') #{address}/api/getmaxmoney
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmaxvote
|
||||
div
|
||||
em #{settings.locale.api_getmaxvote}
|
||||
a(href='/api/getmaxvote') #{address}/api/getmaxvote
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getvote
|
||||
div
|
||||
em #{settings.locale.api_getvote}
|
||||
a(href='/api/getvote') #{address}/api/getvote
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getphase
|
||||
div
|
||||
em #{settings.locale.api_getphase}
|
||||
a(href='/api/getphase') #{address}/api/getphase
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getreward
|
||||
div
|
||||
em #{settings.locale.api_getreward}
|
||||
a(href='/api/getreward') #{address}/api/getreward
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getsupply
|
||||
div
|
||||
em #{settings.locale.api_getsupply}
|
||||
a(href='/api/getsupply') #{address}/api/getsupply
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getnextrewardestimate
|
||||
div
|
||||
em #{settings.locale.api_getnextrewardestimate}
|
||||
a(href='/api/getnextrewardestimate') #{address}/api/getnextrewardestimate
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getnextrewardwhenstr
|
||||
div
|
||||
em #{settings.locale.api_getnextrewardwhenstr}
|
||||
a(href='/api/getnextrewardwhenstr') #{address}/api/getnextrewardwhenstr
|
||||
if settings.api_cmds['getmaxmoney'] != null && settings.api_cmds['getmaxmoney'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmaxmoney
|
||||
div
|
||||
em #{settings.locale.api_getmaxmoney}
|
||||
a(href='/api/getmaxmoney') #{address}/api/getmaxmoney
|
||||
if settings.api_cmds['getmaxvote'] != null && settings.api_cmds['getmaxvote'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getmaxvote
|
||||
div
|
||||
em #{settings.locale.api_getmaxvote}
|
||||
a(href='/api/getmaxvote') #{address}/api/getmaxvote
|
||||
if settings.api_cmds['getvote'] != null && settings.api_cmds['getvote'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getvote
|
||||
div
|
||||
em #{settings.locale.api_getvote}
|
||||
a(href='/api/getvote') #{address}/api/getvote
|
||||
if settings.api_cmds['getphase'] != null && settings.api_cmds['getphase'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getphase
|
||||
div
|
||||
em #{settings.locale.api_getphase}
|
||||
a(href='/api/getphase') #{address}/api/getphase
|
||||
if settings.api_cmds['getreward'] != null && settings.api_cmds['getreward'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getreward
|
||||
div
|
||||
em #{settings.locale.api_getreward}
|
||||
a(href='/api/getreward') #{address}/api/getreward
|
||||
if settings.api_cmds['getsupply'] != null && settings.api_cmds['getsupply'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getsupply
|
||||
div
|
||||
em #{settings.locale.api_getsupply}
|
||||
a(href='/api/getsupply') #{address}/api/getsupply
|
||||
if settings.api_cmds['getnextrewardestimate'] != null && settings.api_cmds['getnextrewardestimate'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getnextrewardestimate
|
||||
div
|
||||
em #{settings.locale.api_getnextrewardestimate}
|
||||
a(href='/api/getnextrewardestimate') #{address}/api/getnextrewardestimate
|
||||
if settings.api_cmds['getnextrewardwhenstr'] != null && settings.api_cmds['getnextrewardwhenstr'] != ''
|
||||
li
|
||||
p
|
||||
div(style='font-weight:bold;') getnextrewardwhenstr
|
||||
div
|
||||
em #{settings.locale.api_getnextrewardwhenstr}
|
||||
a(href='/api/getnextrewardwhenstr') #{address}/api/getnextrewardwhenstr
|
||||
hr
|
||||
h3 Extended API
|
||||
p
|
||||
|
||||
Reference in New Issue
Block a user