diff --git a/index.html b/index.html index 3a670a9ae..25796ab8e 100644 --- a/index.html +++ b/index.html @@ -102,6 +102,7 @@ Connecting to wallet...
+

Create new multisig wallet

Select total number of copayers

@@ -120,7 +121,9 @@
+ ng-click="create(totalCopayers, requiredCopayers)"> + Create {{requiredCopayers}}-of-{{totalCopayers}} wallet +
diff --git a/js/controllers/setup.js b/js/controllers/setup.js index e084218a3..a8f25cb3e 100644 --- a/js/controllers/setup.js +++ b/js/controllers/setup.js @@ -31,12 +31,17 @@ angular.module('copay.setup').controller('SetupController', requiredCopayers: requiredCopayers, totalCopayers: totalCopayers }; - var w = walletFactory.create(); - w.on('open', function(){ + var w = walletFactory.create(opts); + w.on('created', function(){ $location.path('peer'); $rootScope.wallet = w; $rootScope.$digest(); }); + w.on('openError', function(){ + $scope.loading = false; + $rootScope.flashMessage = {type:'error', message: 'Wallet not found'}; + $location.path('signin'); + }); w.netStart(); }; diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 122cdc02a..4b25c800f 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -27,12 +27,7 @@ angular.module('copay.signin').controller('SigninController', }; $scope.create = function() { -console.log('[signin.js.42:create:]'); //TODO - $scope.loading = true; - - var w = walletFactory.create(); - _setupUxHandlers(w); - w.netStart(); + $location.path('setup'); }; $scope.open = function(walletId) { diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 1d2141117..98bc6faba 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -22,6 +22,8 @@ function Wallet(opts) { self[k] = opts[k]; }); + console.log('creating '+opts.requiredCopayers+' of '+opts.totalCopayers+' wallet'); + this.id = opts.id || Wallet.getRandomId(); this.publicKeyRing.walletId = this.id; this.txProposals.walletId = this.id;