diff --git a/public/views/export.html b/public/views/export.html index ecb4e507c..e26266d35 100644 --- a/public/views/export.html +++ b/public/views/export.html @@ -5,15 +5,16 @@
-
+

+
- -
@@ -45,18 +46,13 @@
-
+
- -
- Exporting Walelt: - {{index.walletName}} -
-
From/In the destination device, go to Add wallet > Import wallet and scan this QR code
+
From the destination device, go to Add wallet > Import wallet and scan this QR code
-
+
-
+
- WARNING: The private key of this wallet is not available. The export allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so funds will not be accessible from the export. + WARNING: The private key of this wallet is not available. The export allows to check the wallet balance, transaction history, and create spend proposals from the export. However, does not allow to approve (sign) proposals, so funds will not be accessible from the export.
-
+
diff --git a/public/views/import.html b/public/views/import.html index 32ab29bf9..5b28a0edc 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -29,7 +29,7 @@
  • The password of the recovery phrase (if set)
  • The derivation path
  • -
  • The wallet service URL +
  • The wallet service URL
NOTE: To import a wallet from a 3rd party software, please go to Add Wallet > Create Wallet, and specify the Recovery Phrase there.
@@ -51,7 +51,7 @@
- +
diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index 84008adf4..7cbeaf093 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -23,6 +23,7 @@ angular.module('copayApp.controllers').controller('backupController', handleEncryptedWallet(fc, function(err) { if (err) { + $log.warn('Error decrypting credentials:', $scope.error); go.path(prevState); return; } diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index d076759c7..713066340 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -12,6 +12,7 @@ angular.module('copayApp.controllers').controller('exportController', $scope.error = null; $scope.init = function(state) { + $scope.exportQR = false; $scope.noSignEnabled = false; $scope.showAdvanced = false; prevState = state || 'walletHome'; @@ -36,12 +37,16 @@ angular.module('copayApp.controllers').controller('exportController', }); }; + /* + EXPORT WITHOUT PRIVATE KEY - PENDING + $scope.noSignEnabledChange = function() { $scope.exportWalletInfo = encodeWalletInfo(); $timeout(function() { $scope.$apply(); }, 1); }; + */ $scope.$on('$destroy', function() { walletService.lock(fc); @@ -61,6 +66,7 @@ angular.module('copayApp.controllers').controller('exportController', function encodeWalletInfo() { var c = fc.credentials; + var derivationPath = fc.credentials.getBaseAddressDerivationPath(); var encodingType = { mnemonic: 1, xpriv: 2, @@ -81,13 +87,19 @@ angular.module('copayApp.controllers').controller('exportController', } } } else { + /* + EXPORT WITHOUT PRIVATE KEY - PENDING + info = { type: encodingType.xpub, data: c.xPubKey } + */ + + return null; } - var code = info.type + '|' + info.data + '|' + c.network.charAt(0).toLowerCase() + '|' + c.account + '|' + c.derivationStrategy + '|' + (c.mnemonicHasPassphrase); + var code = info.type + '|' + info.data + '|' + c.network.toLowerCase() + '|' + derivationPath + '|' + (c.mnemonicHasPassphrase); return code; }; diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 496e451ed..59a80e138 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -12,7 +12,6 @@ angular.module('copayApp.controllers').controller('importController', $scope.bwsurl = defaults.bws.url; $scope.derivationPath = derivationPathHelper.default; $scope.account = 1; - $scope.processingCode = null; $scope.importErr = false; $scope.fromQR = null; @@ -35,15 +34,13 @@ angular.module('copayApp.controllers').controller('importController', } }; - $scope.processCode = function(code) { + $scope.processWalletInfo = function(code) { $scope.fromQR = null; $scope.importErr = false; $scope.error = null; - ongoingProcess.set('processingCode', true); var parsedCode = code.split('|'); - if (parsedCode.length != 6) { - ongoingProcess.set('processingCode', false); + if (parsedCode.length != 5) { $scope.error = gettext('Cannot read the code properly. Missing parameters'); return; } @@ -51,48 +48,18 @@ angular.module('copayApp.controllers').controller('importController', var info = { type: parsedCode[0], data: parsedCode[1], - network: parsedCode[2] == 't' ? 'testnet' : 'livenet', - account: parseInt(parsedCode[3]), - derivationStrategy: parsedCode[4], - hasPassphrase: parsedCode[5] == 'true' ? true : false + network: parsedCode[2], + derivationPath: parsedCode[3], + hasPassphrase: parsedCode[4] == 'true' ? true : false }; if (info.type == 1 && info.hasPassphrase) $scope.error = gettext('Password required. Make sure to enter your password in advanced options'); - var client = bwcService.getClient(null, null); - - if (info.type == 1) { - client.seedFromMnemonic(info.data, { - network: info.network, - account: info.account, - derivationStrategy: info.derivationStrategy - }); - } - - if (info.type == 2) { - client.seedFromExtendedPrivateKey(info.data, { - account: info.account, - derivationStrategy: info.derivationStrategy - }); - } - - if (info.type == 3) { - client.seedFromExtendedPublicKey(info.data, { - account: info.account, - derivationStrategy: info.derivationStrategy - }); - } - - $scope.derivationPath = client.credentials.getBaseAddressDerivationPath(); - - if (client.credentials.network == 'testnet') - $scope.testnetEnabled = true; - else - $scope.testnetEnabled = false; + $scope.derivationPath = info.derivationPath; + $scope.testnetEnabled = info.network == 'testnet' ? true : false; $timeout(function() { - ongoingProcess.set('processingCode', false); $scope.fromQR = true; $scope.words = null; dataFromQR = info.data; @@ -166,6 +133,28 @@ angular.module('copayApp.controllers').controller('importController', }, 100); }; + /* + IMPORT FROM PUBLIC KEY - PENDING + + var _importExtendedPublicKey = function(xPubKey, opts) { + ongoingProcess.set('importingWallet', true); + $timeout(function() { + profileService.importExtendedPublicKey(opts, function(err, walletId) { + ongoingProcess.set('importingWallet', false); + if (err) { + $scope.error = err; + return $timeout(function() { + $scope.$apply(); + }); + } + $rootScope.$emit('Local/WalletImported', walletId); + notification.success(gettext('Success'), gettext('Your wallet has been imported correctly')); + go.walletHome(); + }); + }, 100); + }; + */ + var _importMnemonic = function(words, opts) { ongoingProcess.set('importingWallet', true); @@ -269,6 +258,8 @@ angular.module('copayApp.controllers').controller('importController', $scope.error = gettext('Please enter the recovery phrase'); } else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) { return _importExtendedPrivateKey(words, opts); + } else if (words.indexOf('xpub') == 0 || words.indexOf('tpuv') == 0) { + return _importExtendedPublicKey(words, opts); } else { var wordList = words.split(/[\u3000\s]+/); diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js index fba2093a4..836061f5f 100644 --- a/src/js/services/onGoingProcess.js +++ b/src/js/services/onGoingProcess.js @@ -28,7 +28,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti 'importingWallet': gettext('Importing Wallet...'), 'sweepingWallet': gettext('Sweeping Wallet...'), 'deletingWallet': gettext('Deleting Wallet...'), - 'processingCode': gettext('Processing code...'), + 'extractingWalletInfo': gettext('Extracting Wallet Information...'), }; root.clear = function() { diff --git a/src/sass/main.scss b/src/sass/main.scss index 7a96f9050..aeb6bd3e2 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -699,6 +699,10 @@ ul.manage li { padding-left: 25px; } +.p15l { + padding-left: 15px; +} + .p15 { padding: 15px; }