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,26 +114,22 @@ Insight.prototype.getUnspent = function(addresses, cb) {
var all = [];
_asyncForEach(addresses, function(addr, callback) {
var options = {
host: self.host,
port: self.port,
scheme: self.scheme,
method: 'GET',
path: '/api/addr/' + addr + '/utxo',
var options = {
host: self.host,
port: self.port,
scheme: self.scheme,
method: 'GET',
path: '/api/addrs/' + addresses.join(',') + '/utxo',
headers: {
'Access-Control-Request-Headers': ''
}
};
headers: {
'Access-Control-Request-Headers': ''
}
};
self._request(options, function(err, res) {
if (res && res.length > 0) {
all = all.concat(res);
}
callback();
});
}, function() {
self._request(options, function(err, res) {
if (res && res.length > 0) {
all = all.concat(res);
}
return cb(all);
});
};

View file

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