added balance for each address

This commit is contained in:
Mario Colque 2014-04-16 18:01:37 -03:00
commit 97ecd66bd8
2 changed files with 19 additions and 5 deletions

View file

@ -5,18 +5,32 @@ angular.module('copay.home').controller('HomeController',
$scope.title = 'Home';
$scope.oneAtATime = true;
$scope.addrBalance = {};
var _getBalance = function() {
$scope.addrs.forEach(function(addr) {
$rootScope.wallet.blockchain.listUnspent([addr], function(unspent) {
var balance = $rootScope.wallet.blockchain.getBalance(unspent);
$scope.addrBalance[addr] = balance;
$scope.$digest();
});
});
};
if (!$rootScope.wallet || !$rootScope.wallet.id) {
$location.path('signin');
}
else {
} else {
$scope.addrs = $rootScope.wallet.getAddressesStr();
$scope.selectedAddr = $scope.addrs[0];
_getBalance();
}
$scope.newAddr = function() {
var a = $rootScope.wallet.generateAddress();
$scope.addrs.push({ addrStr: a.toString() });
var a = $rootScope.wallet.generateAddress().toString();
$scope.addrs.push(a);
_getBalance();
};
$scope.selectAddr = function(addr) {