Rename api for getlasttxsajax to getlasttxs
This commit is contained in:
@@ -393,6 +393,32 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
get_last_txs: function(req, cb) {
|
||||
if (typeof req.query.length === 'undefined' || isNaN(req.query.length) || req.query.length > settings.index.last_txs)
|
||||
req.query.length = settings.index.last_txs;
|
||||
if (typeof req.query.start === 'undefined' || isNaN(req.query.start) || req.query.start < 0)
|
||||
req.query.start = 0;
|
||||
if (typeof req.params.min === 'undefined' || isNaN(req.params.min ) || req.params.min < 0)
|
||||
req.params.min = 0;
|
||||
else
|
||||
req.params.min = (req.params.min * 100000000);
|
||||
|
||||
this.get_last_txs_ajax(req.query.start, req.query.length, req.params.min,function(txs, count) {
|
||||
var data = [];
|
||||
for(i=0; i<txs.length; i++) {
|
||||
var row = [];
|
||||
row.push(txs[i].blockindex);
|
||||
row.push(txs[i].blockhash);
|
||||
row.push(txs[i].txid);
|
||||
row.push(txs[i].vout.length);
|
||||
row.push((txs[i].total));
|
||||
row.push(new Date((txs[i].timestamp) * 1000).toUTCString());
|
||||
data.push(row);
|
||||
}
|
||||
return cb(data, req.query.draw, count);
|
||||
});
|
||||
},
|
||||
|
||||
get_last_txs_ajax: function(start, length, min, cb) {
|
||||
Tx.find({'total': {$gte: min}}).countDocuments(function(err, count){
|
||||
Tx.find({'total': {$gte: min}}).sort({blockindex: -1}).skip(Number(start)).limit(Number(length)).exec(function(err, txs){
|
||||
|
||||
Reference in New Issue
Block a user