use new multiutxo insight call

This commit is contained in:
Manuel Araoz 2014-05-12 18:47:17 -03:00
commit 9e96bc2188
2 changed files with 15 additions and 19 deletions

View file

@ -114,13 +114,12 @@ Insight.prototype.getUnspent = function(addresses, cb) {
var all = []; var all = [];
_asyncForEach(addresses, function(addr, callback) {
var options = { var options = {
host: self.host, host: self.host,
port: self.port, port: self.port,
scheme: self.scheme, scheme: self.scheme,
method: 'GET', method: 'GET',
path: '/api/addr/' + addr + '/utxo', path: '/api/addrs/' + addresses.join(',') + '/utxo',
headers: { headers: {
'Access-Control-Request-Headers': '' 'Access-Control-Request-Headers': ''
@ -131,9 +130,6 @@ Insight.prototype.getUnspent = function(addresses, cb) {
if (res && res.length > 0) { if (res && res.length > 0) {
all = all.concat(res); all = all.concat(res);
} }
callback();
});
}, function() {
return cb(all); return cb(all);
}); });
}; };

View file

@ -97,7 +97,6 @@ angular.module('copay.controllerUtils')
}; };
root.updateBalance = function(cb) { root.updateBalance = function(cb) {
root.setSocketHandlers();
$rootScope.balanceByAddr = {}; $rootScope.balanceByAddr = {};
var w = $rootScope.wallet; var w = $rootScope.wallet;
$rootScope.addrInfos = w.getAddressesInfo(); $rootScope.addrInfos = w.getAddressesInfo();
@ -118,6 +117,7 @@ angular.module('copay.controllerUtils')
$rootScope.loading = false; $rootScope.loading = false;
if (cb) cb(); if (cb) cb();
}); });
root.setSocketHandlers();
}; };
root.setSocketHandlers = function() { root.setSocketHandlers = function() {