many optimizations in addresses pulling

This commit is contained in:
Matias Alejo Garcia 2014-05-16 18:33:06 -03:00
commit 398daf3f05
9 changed files with 183 additions and 130 deletions

View file

@ -6,7 +6,13 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.title = 'Transactions';
$scope.loading = false;
$scope.send = function (ntxid) {
$scope.update = function () {
$scope.loading = false;
controllerUtils.updateTxs();
$rootScope.$digest();
};
$scope.send = function (ntxid,cb) {
$scope.loading = true;
$rootScope.txAlertCount = 0;
var w = $rootScope.wallet;
@ -16,34 +22,32 @@ angular.module('copay.transactions').controller('TransactionsController',
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
: {type:'error', message: 'There was an error sending the Transaction'}
;
controllerUtils.updateTxs();
$scope.loading = false;
$rootScope.$digest();
if (cb) return cb();
else $scope.update();
});
};
$scope.sign = function (ntxid) {
$scope.loading = true;
var w = $rootScope.wallet;
var ret = w.sign(ntxid);
if (!ret) {
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
controllerUtils.updateTxs();
$scope.loading = false;
$rootScope.$digest();
return;
}
var p = w.txProposals.getTxProposal(ntxid);
if (p.builder.isFullySigned()) {
$scope.send(ntxid);
controllerUtils.updateTxs();
}
else {
controllerUtils.updateTxs();
$scope.loading = false;
$rootScope.$digest();
}
w.sign(ntxid, function(ret){
if (!ret) {
$rootScope.flashMessage = {
type:'error',
message: 'There was an error signing the Transaction',
};
$scope.update();
}
else {
var p = w.txProposals.getTxProposal(ntxid);
if (p.builder.isFullySigned()) {
$scope.send(ntxid, function() {
$scope.update();
});
}
else $scope.update();
}
});
};
$scope.getTransactions = function() {