diff --git a/app/controllers/addressProperties.js b/app/controllers/addressProperties.js index 098db8d8..c30f2108 100644 --- a/app/controllers/addressProperties.js +++ b/app/controllers/addressProperties.js @@ -45,3 +45,16 @@ exports.totalReceived = function(req, res, next) { } }); }; + +exports.totalSent = function(req, res, next) { + var a = getAddr(req, res, next); + if (a) + a.update(function(err) { + if (err) { + return common.handleErrors(err, res); + } + else { + return res.jsonp(a.totalSentSat); + } + }); +}; diff --git a/config/routes.js b/config/routes.js index 4fdd8cda..6b206c0c 100644 --- a/config/routes.js +++ b/config/routes.js @@ -36,6 +36,7 @@ module.exports = function(app) { var addressProperties = require('../app/controllers/addressProperties.js'); app.get(apiPrefix + '/addr/:addr/balance', addressProperties.balance); app.get(apiPrefix + '/addr/:addr/totalReceived', addressProperties.totalReceived); + app.get(apiPrefix + '/addr/:addr/totalSent', addressProperties.totalSent); // Status route var st = require('../app/controllers/status');