diff --git a/public/views/export.html b/public/views/export.html index 26fa7e069..eec227984 100644 --- a/public/views/export.html +++ b/public/views/export.html @@ -95,8 +95,8 @@ -
- +
+
diff --git a/public/views/import.html b/public/views/import.html index c79c0086b..882b643ae 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -69,7 +69,7 @@ diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index 62244fae3..395bdcd46 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('exportController', $scope.isCordova = platformInfo.isCordova; $scope.isSafari = platformInfo.isSafari; $scope.error = null; - console.log(fc.credentials); $scope.init = function(state) { $scope.QROpts = false; @@ -80,9 +79,7 @@ angular.module('copayApp.controllers').controller('exportController', } } - var code = info.type + '|' + c.network.charAt(0).toLowerCase() + '|' + info.data + '|' + c.account + '|' + c.derivationStrategy + - '|' + (c.mnemonicHasPassphrase || null); - return code; + return info.type + '|' + info.data; }; $scope.downloadWalletBackup = function() { diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index a9afd7d97..4f05bb486 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -36,35 +36,42 @@ angular.module('copayApp.controllers').controller('importController', }; $scope.processCode = function(code) { + ongoingProcess.set('processingCode', true); + self.importErr = false; var parsedCode = code.split('|'); - var derivationStrategy = "44'"; - var networkVal; + + if (parsedCode.length != 2) { + ongoingProcess.set('processingCode', false); + return; + } var info = { type: parsedCode[0], - network: parsedCode[1], - data: parsedCode[2], - account: parsedCode[3], - derivationStrategy: parsedCode[4], - hasPassphrase: parsedCode[5] + data: parsedCode[1], }; - $scope.words = info.data; + var client = bwcService.getClient(null, null); - if (info.network == 't') { - networkVal = "1'"; - $scope.testnetEnabled = true; - } else { - networkVal = "0'"; - $scope.testnetEnabled = false; + if (info.type == 1) { + client.seedFromMnemonic(info.data, {}); + } + if (info.type == 2) { + client.seedFromExtendedPrivateKey(info.data, {}); + } + if (info.type == 3) { + client.seedFromExtendedPublicKey(info.data, {}); } - if (info.derivationStrategy == 'BIP45' || info.derivationStrategy == 'BIP48') - derivationStrategy = info.derivationStrategy.substring(3, 5) + "'"; + $scope.words = info.data; + $scope.derivationPath = client.credentials.getBaseAddressDerivationPath(); - $scope.derivationPath = "m/" + derivationStrategy + '/' + networkVal + '/' + info.account + "'"; + if (client.credentials.network == 'testnet') + $scope.testnetEnabled = true; + else + $scope.testnetEnabled = false; $timeout(function() { + ongoingProcess.set('processingCode', false); $rootScope.$apply(); }, 1); }; diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js index 9a9ed7547..fba2093a4 100644 --- a/src/js/services/onGoingProcess.js +++ b/src/js/services/onGoingProcess.js @@ -28,6 +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...'), }; root.clear = function() {