diff --git a/public/views/paperWallet.html b/public/views/paperWallet.html index 9a0c8b178..11e706256 100644 --- a/public/views/paperWallet.html +++ b/public/views/paperWallet.html @@ -1,7 +1,7 @@
+ ng-init="titleSection='Sweep paper wallet'; goBackToState = 'preferencesAdvanced';">
@@ -24,17 +24,18 @@
- + + Funds will be transfered to the wallet: {{index.alias}}
- +
diff --git a/public/views/preferencesAdvanced.html b/public/views/preferencesAdvanced.html index 974df100a..a7d41335e 100644 --- a/public/views/preferencesAdvanced.html +++ b/public/views/preferencesAdvanced.html @@ -19,7 +19,7 @@
  • - Scan Paper Wallet + Sweep paper wallet
  • diff --git a/src/js/controllers/paperWallet.js b/src/js/controllers/paperWallet.js index 42f18e365..070126fbe 100644 --- a/src/js/controllers/paperWallet.js +++ b/src/js/controllers/paperWallet.js @@ -1,5 +1,5 @@ angular.module('copayApp.controllers').controller('paperWalletController', - function($scope, $http, profileService, addressService) { + function($scope, $http, $timeout, profileService, go, addressService) { self = this; var fc = profileService.focusedClient; @@ -7,22 +7,19 @@ angular.module('copayApp.controllers').controller('paperWalletController', self.onQrCodeScanned = function(data) { $scope.privateKey = data; - console.log(data); } self.createTx = function(privateKey, passphrase) { - console.log("entro"); - console.log(privateKey); - console.log(passphrase); if (!privateKey) self.error = "Enter privateKey or scann for one"; - this.getRawTx(privateKey, passphrase, function(err, rawTx, utxos) { - console.log(utxos); - console.log("creada"); + self.getRawTx(privateKey, passphrase, function(err, rawtx, utxos) { if (err) self.error = err.toString(); else { self.balance = (utxos / 1e8).toFixed(8); - rawTx = rawTx; + rawTx = rawtx; } + $timeout(function() { + $scope.$apply(); + }, 1); }); }; @@ -39,7 +36,6 @@ angular.module('copayApp.controllers').controller('paperWalletController', fc.buildTxFromPrivateKey(privateKey, destinationAddress, null, function(err, tx) { if (err) return cb(err); - console.log(tx.serialize()); return cb(null, tx.serialize(), utxos); }); }); @@ -54,7 +50,6 @@ angular.module('copayApp.controllers').controller('paperWalletController', fc.buildTxFromPrivateKey(privateKey, destinationAddress, null, function(err, tx) { if (err) return cb(err); - console.log(tx.serialize()); return cb(null, tx.serialize(), utxos); }); }); @@ -64,15 +59,18 @@ angular.module('copayApp.controllers').controller('paperWalletController', self.transaction = function() { - self.doTransaction(rawTx).then(function(response) { - console.log(response); //mostrar pantalla de sent successfully + self.doTransaction(rawTx).then(function(err, response) { + self.goHome(); }, function(err) { self.error = err; - console.log(err); //mostrar mensaje de error en la pantalla }); }; + self.goHome = function() { + go.walletHome(); + }; + self.doTransaction = function(rawTx) { return $http.post('https://insight.bitpay.com/api/tx/send', { rawtx: rawTx