From 0ee0161e1055b7eedeb06e0acc6842e66b14c92d Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 18 Aug 2015 18:23:35 -0300 Subject: [PATCH] v2/wallets/ endpoint --- lib/expressapp.js | 48 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/lib/expressapp.js b/lib/expressapp.js index acdfe8e..5c54efa 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -159,43 +159,23 @@ ExpressApp.prototype.start = function(opts, cb) { }); }); - + // DEPRECATED router.get('/v1/wallets/', function(req, res) { getServerWithAuth(req, res, function(server) { - var result = {}; - async.parallel([ - - function(next) { - server.getWallet({}, function(err, wallet) { - if (err) return next(err); - result.wallet = wallet; - next(); - }); - }, - function(next) { - server.getBalance({}, function(err, balance) { - if (err) return next(err); - result.balance = balance; - next(); - }); - }, - function(next) { - server.getPendingTxs({}, function(err, pendingTxps) { - if (err) return next(err); - result.pendingTxps = pendingTxps; - next(); - }); - }, - function(next) { - server.getPreferences({}, function(err, preferences) { - if (err) return next(err); - result.preferences = preferences; - next(); - }); - }, - ], function(err) { + server.getStatus({ + includeExtendedInfo: true + }, function(err, status) { if (err) return returnError(err, res, req); - res.json(result); + res.json(status); + }); + }); + }); + + router.get('/v2/wallets/', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.getStatus({}, function(err, status) { + if (err) return returnError(err, res, req); + res.json(status); }); }); });