Merge pull request #5076 from gabrielbazan7/fix/paperWallet

fix paper wallet scanner
This commit is contained in:
Jason Dreyzehner 2016-11-17 15:54:11 -05:00 committed by GitHub
commit be4e5ee131
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $timeout, $log, $ionicModal, $ionicHistory, popupService, gettextCatalog, platformInfo, configService, profileService, $state, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
$scope.onQrCodeScanned = function(data) {
$scope.onQrCodeScannedPaperWallet = function(data) {
$scope.formData.inputData = data;
$scope.onData(data);
};
@ -14,11 +14,11 @@ angular.module('copayApp.controllers').controller('paperWalletController',
function _scanFunds(cb) {
function getPrivateKey(scannedKey, isPkEncrypted, passphrase, cb) {
if (!isPkEncrypted) return cb(null, scannedKey);
wallet.decryptBIP38PrivateKey(scannedKey, passphrase, null, cb);
$scope.wallet.decryptBIP38PrivateKey(scannedKey, passphrase, null, cb);
};
function getBalance(privateKey, cb) {
wallet.getBalanceFromPrivateKey(privateKey, cb);
$scope.wallet.getBalanceFromPrivateKey(privateKey, cb);
};
function checkPrivateKey(privateKey) {
@ -66,13 +66,13 @@ angular.module('copayApp.controllers').controller('paperWalletController',
};
function _sweepWallet(cb) {
walletService.getAddress(wallet, true, function(err, destinationAddress) {
walletService.getAddress($scope.wallet, true, function(err, destinationAddress) {
if (err) return cb(err);
wallet.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) {
$scope.wallet.buildTxFromPrivateKey($scope.privateKey, destinationAddress, null, function(err, tx) {
if (err) return cb(err);
wallet.broadcastRawTx({
$scope.wallet.broadcastRawTx({
rawTx: tx.serialize(),
network: 'livenet'
}, function(err, txid) {
@ -109,7 +109,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
$scope.tx = {};
$scope.tx.amountStr = $scope.balance;
$scope.type = type;
$scope.color = wallet.backgroundColor;
$scope.color = $scope.wallet.backgroundColor;
$scope.cb = cb;
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {

View File

@ -32,7 +32,7 @@
</label>
</div>
<div class="col text-center">
<qr-scanner class="size-24" ng-style="{'line-height': '45px'}" on-scan="onQrCodeScanned(data)"></qr-scanner>
<qr-scanner class="size-24" ng-style="{'line-height': '45px'}" on-scan="onQrCodeScannedPaperWallet(data)"></qr-scanner>
</div>
</div>
<div class="row" ng-show="isPkEncrypted">