diff --git a/app.js b/app.js index d55de4586..14013def1 100644 --- a/app.js +++ b/app.js @@ -85,6 +85,29 @@ app.use('/ext/getbalance/:hash', function(req,res){ }); }); +// light endpoint for heavy usage of received and sent coins added by LucaPaterlini (founder of Crowdcoin) support@crowdcoin.site + +app.use('/ext/gettotalreceived/:hash', function(req,res){ + db.get_address(req.param('hash'), function(address){ + if (address) { + res.send(address.received / 100000000); + } else { + res.send({ error: 'address not found.', hash: req.param('hash')}) + } + }); +}); + + +app.use('/ext/gettotalsent/:hash', function(req,res){ + db.get_address(req.param('hash'), function(address){ + if (address) { + res.send(address.sent / 100000000); + } else { + res.send({ error: 'address not found.', hash: req.param('hash')}) + } + }); +}); + app.use('/ext/getdistribution', function(req,res){ db.get_richlist(settings.coin, function(richlist){ db.get_stats(settings.coin, function(stats){ diff --git a/views/info.jade b/views/info.jade index a9f9c1ba3..e184ec27c 100644 --- a/views/info.jade +++ b/views/info.jade @@ -108,6 +108,16 @@ block content * **getbalance (/ext/getbalance/hash)** *Returns current balance of given address* [#{address}/ext/getbalance/#{hashes.address}](/ext/getbalance/#{hashes.address}) + + * **gettotalreceived (/ext/gettotalreceived/hash)** + *Returns current balance of given address* + [#{address}/ext/gettotalreceived/#{hashes.address}](/ext/gettotalreceived/#{hashes.address}) + + * **gettotalsent (/ext/gettotalsent/hash)** + *Returns current balance of given address* + [#{address}/ext/gettotalsent/#{hashes.address}](/ext/gettotalsent/#{hashes.address}) + + * **getlasttxs (/ext/getlasttxs/count/min)** *Returns last [count] transactions greater than [min]*