diff --git a/js/controllers/home.js b/js/controllers/home.js index 0d762f925..bfdcdd026 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -6,14 +6,13 @@ angular.module('copay.home').controller('HomeController', $scope.oneAtATime = true; - if (!$rootScope.wallet.id) { + if (!$rootScope.wallet || !$rootScope.wallet.id) { $location.path('signin'); } - - - - $scope.addrs = $rootScope.wallet.publicKeyRing.getAddresses(); - $scope.selectedAddr = $scope.addrs[0]; + else { + $scope.addrs = $rootScope.wallet.publicKeyRing.getAddresses(); + $scope.selectedAddr = $scope.addrs[0]; + } $scope.newAddr = function() { var a = $rootScope.wallet.publicKeyRing.generateAddress(); diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 13378f66f..ff62315fe 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -23,13 +23,12 @@ Wallet.prototype._startInterface = function(config) { this.blockchain = new Blockchain(config.blockchain); this.networkName = config.networkName; - this.requiredCopayers = config.requiredCopayers; - this.totalCopayers = config.totalCopayers; + this.requiredCopayers = config.wallet.requiredCopayers; + this.totalCopayers = config.wallet.totalCopayers; }; Wallet.prototype.create = function(opts) { - this.id = opts.id || Wallet.getRandomId(); console.log('### CREATING NEW WALLET.' + (opts.id ? ' USING ID: ' + opts.id : ' NEW ID'));