Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/controllers/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,28 @@ exports.show = function(req, res, next) {
}
};

exports.multishow = function(req, res, next) {
if (!checkSync(req, res)) return;
var as = getAddrs(req, res, next);

if (as) {
var addrs = [];
async.eachLimit(as, RPC_CONCURRENCY, function(a, callback) {
a.update(function(err) {
if (err) callback(err);
addrs = addrs.concat(a.getObj());
callback();
}, {
txLimit: req.query.noTxList ? 0 : -1,
ignoreCache: req.param('noCache')
});
}, function(err) { // finished callback
if (err) return common.handleErrors(err, res);
res.jsonp(addrs);
});
}
};



exports.utxo = function(req, res, next) {
Expand Down
2 changes: 2 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module.exports = function(app) {
var addresses = require('../app/controllers/addresses');
app.get(apiPrefix + '/addr/:addr', addresses.show);
app.get(apiPrefix + '/addr/:addr/utxo', addresses.utxo);
app.get(apiPrefix + '/addrs/:addrs/info', addresses.multishow);
app.post(apiPrefix + '/addrs/info', addresses.multishow);
app.get(apiPrefix + '/addrs/:addrs/utxo', addresses.multiutxo);
app.post(apiPrefix + '/addrs/utxo', addresses.multiutxo);
app.get(apiPrefix + '/addrs/:addrs/txs', addresses.multitxs);
Expand Down