fix hw import2

This commit is contained in:
Matias Alejo Garcia 2016-12-28 17:50:53 -03:00
commit 57251c0b31
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 11 additions and 5 deletions

View file

@ -24,17 +24,19 @@ angular.module('copayApp.controllers').controller('importController',
$scope.seedOptions = []; $scope.seedOptions = [];
if (isChromeApp || isDevel) { if (isChromeApp) {
$scope.seedOptions.push({ $scope.seedOptions.push({
id: 'ledger', id: 'ledger',
label: 'Ledger Hardware Wallet', label: 'Ledger Hardware Wallet',
}); });
}
if (isChromeApp || isDevel) {
$scope.seedOptions.push({ $scope.seedOptions.push({
id: 'trezor', id: 'trezor',
label: 'Trezor Hardware Wallet', label: 'Trezor Hardware Wallet',
}); });
$scope.seedSource = $scope.seedOptions[0]; $scope.formData.seedSource = $scope.seedOptions[0];
} }
}; };
@ -288,7 +290,7 @@ angular.module('copayApp.controllers').controller('importController',
var account = $scope.formData.account; var account = $scope.formData.account;
if ($scope.seedSource.id == 'trezor') { if ($scope.formData.seedSource.id == 'trezor') {
if (account < 1) { if (account < 1) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number')); popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return; return;
@ -296,7 +298,7 @@ angular.module('copayApp.controllers').controller('importController',
account = account - 1; account = account - 1;
} }
switch ($scope.seedSource.id) { switch ($scope.formData.seedSource.id) {
case ('ledger'): case ('ledger'):
ongoingProcess.set('connectingledger', true); ongoingProcess.set('connectingledger', true);
$scope.importLedger(account); $scope.importLedger(account);

View file

@ -19,7 +19,11 @@ angular.module('copayApp.services')
root.getXPubKey = function(path, callback) { root.getXPubKey = function(path, callback) {
$log.debug('TREZOR deriving xPub path:', path); $log.debug('TREZOR deriving xPub path:', path);
TrezorConnect.getXPubKey(path, callback); try {
TrezorConnect.getXPubKey(path, callback);
} catch (e) {
callback('Error connecting Trezor');
}
}; };