diff --git a/public/views/walletDetails.html b/public/views/walletDetails.html
index 3bd314da6..59d725aa4 100644
--- a/public/views/walletDetails.html
+++ b/public/views/walletDetails.html
@@ -19,6 +19,11 @@
+
+ This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information.
+
+
+
Scan status finished with error
Tap to retry
diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js
index afa0e3223..f9a23f91c 100644
--- a/src/js/controllers/walletDetails.js
+++ b/src/js/controllers/walletDetails.js
@@ -1,6 +1,11 @@
'use strict';
-angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService, externalLinkService) {
+angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService, externalLinkService) {
+ var isCordova = platformInfo.isCordova;
+ var isWP = platformInfo.isWP;
+ var isAndroid = platformInfo.isAndroid;
+ var isChromeApp = platformInfo.isChromeApp;
+
var HISTORY_SHOW_LIMIT = 10;
var currentTxHistoryPage;
var wallet;
@@ -65,14 +70,19 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updateStatus = function(force) {
$scope.updatingStatus = true;
$scope.updateStatusError = false;
+ $scope.walletNotRegistered = false;
walletService.getStatus(wallet, {
force: !!force,
}, function(err, status) {
$scope.updatingStatus = false;
if (err) {
+ if (err === 'WALLET_NOT_REGISTERED') {
+ $scope.walletNotRegistered = true;
+ } else {
+ $scope.updateStatusError = true;
+ }
$scope.status = null;
- $scope.updateStatusError = true;
return;
}
@@ -140,7 +150,15 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
};
$scope.recreate = function() {
- walletService.recreate();
+ walletService.recreate(wallet, function(err) {
+ $scope.init();
+ if (err) return;
+ $timeout(function() {
+ walletService.startScan(wallet, function() {
+ $scope.$apply();
+ });
+ });
+ });
};
$scope.updateTxHistory = function(cb) {
@@ -158,7 +176,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$timeout(function() {
$scope.$apply();
}, 1);
-
};
$timeout(function() {
diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js
index 8f6b3c014..be1d5ee70 100644
--- a/src/js/services/onGoingProcess.js
+++ b/src/js/services/onGoingProcess.js
@@ -7,31 +7,31 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
var ongoingProcess = {};
var processNames = {
- 'scanning': gettext('Scanning Wallet funds...'),
- 'recreating': gettext('Recreating Wallet...'),
- 'generatingCSV': gettext('Generating .csv file...'),
- 'creatingTx': gettext('Creating transaction'),
- 'sendingTx': gettext('Sending transaction'),
- 'signingTx': gettext('Signing transaction'),
'broadcastingTx': gettext('Broadcasting transaction'),
- 'rejectTx': gettext('Rejecting payment proposal'),
- 'removeTx': gettext('Deleting payment proposal'),
- 'fetchingPayPro': gettext('Fetching Payment Information'),
'calculatingFee': gettext('Calculating fee'),
- 'joiningWallet': gettext('Joining Wallet...'),
- 'retrivingInputs': gettext('Retrieving inputs information'),
- 'creatingWallet': gettext('Creating Wallet...'),
- 'validatingWallet': gettext('Validating wallet integrity...'),
- 'connectingledger': gettext('Waiting for Ledger...'),
- 'connectingtrezor': gettext('Waiting for Trezor...'),
- 'validatingWords': gettext('Validating recovery phrase...'),
'connectingCoinbase': gettext('Connecting to Coinbase...'),
'connectingGlidera': gettext('Connecting to Glidera...'),
- 'importingWallet': gettext('Importing Wallet...'),
- 'sweepingWallet': gettext('Sweeping Wallet...'),
+ 'connectingledger': gettext('Waiting for Ledger...'),
+ 'connectingtrezor': gettext('Waiting for Trezor...'),
+ 'creatingTx': gettext('Creating transaction'),
+ 'creatingWallet': gettext('Creating Wallet...'),
'deletingWallet': gettext('Deleting Wallet...'),
'extractingWalletInfo': gettext('Extracting Wallet Information...'),
+ 'fetchingPayPro': gettext('Fetching Payment Information'),
+ 'generatingCSV': gettext('Generating .csv file...'),
'gettingFeeLevels': gettext('Getting fee levels...'),
+ 'importingWallet': gettext('Importing Wallet...'),
+ 'joiningWallet': gettext('Joining Wallet...'),
+ 'recreating': gettext('Recreating Wallet...'),
+ 'rejectTx': gettext('Rejecting payment proposal'),
+ 'removeTx': gettext('Deleting payment proposal'),
+ 'retrivingInputs': gettext('Retrieving inputs information'),
+ 'scanning': gettext('Scanning Wallet funds...'),
+ 'sendingTx': gettext('Sending transaction'),
+ 'signingTx': gettext('Signing transaction'),
+ 'sweepingWallet': gettext('Sweeping Wallet...'),
+ 'validatingWallet': gettext('Validating wallet integrity...'),
+ 'validatingWords': gettext('Validating recovery phrase...'),
};
root.clear = function() {
diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js
index f5bf2e45d..204869c61 100644
--- a/src/js/services/walletService.js
+++ b/src/js/services/walletService.js
@@ -10,6 +10,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.SOFT_CONFIRMATION_LIMIT = 12;
root.SAFE_CONFIRMATIONS = 6;
+ var errors = bwcService.getErrors();
+
// UI Related
root.openStatusModal = function(type, txp, cb) {
var scope = $rootScope.$new(true);
@@ -175,6 +177,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
twoStep: true
}, function(err, ret) {
if (err) {
+ if (err instanceof errors.NOT_AUTHORIZED) {
+ return cb('WALLET_NOT_REGISTERED');
+ }
return cb(bwcError.msg(err, gettext('Could not update Wallet')));
}
return cb(null, ret);
@@ -296,7 +301,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
var getSavedTxs = function(walletId, cb) {
-
storageService.getTxHistory(walletId, function(err, txs) {
if (err) return cb(err);
@@ -671,41 +675,30 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
- // walletHome
root.recreate = function(wallet, cb) {
+ $log.debug('Recreating wallet:', wallet.id);
ongoingProcess.set('recreating', true);
wallet.recreateWallet(function(err) {
wallet.notAuthorized = false;
ongoingProcess.set('recreating', false);
-
- if (err) {
- handleError(err);
- return;
- }
- root.startScan(wallet);
-
- // TODO TODO TODO TODO:
- // Do it on the controller
- // profileService.bindWalletClient(wallet, {
- // force: true
- // });
+ return cb(err);
});
};
- root.startScan = function(wallet) {
- $log.debug('Scanning wallet ' + wallet.credentials.walletId);
+ root.startScan = function(wallet, cb) {
+ cb = cb || function() {};
+
+ $log.debug('Scanning wallet ' + wallet.id);
if (!wallet.isComplete()) return;
- // wallet.updating = true;
-
+ wallet.updating = true;
+ ongoingProcess.set('scanning', true);
wallet.startScan({
includeCopayerBranches: true,
}, function(err) {
-
- if (err && wallet.walletId == walletId) {
- wallet.updating = false;
- handleError(err);
- }
+ wallet.updating = false;
+ ongoingProcess.set('scanning', false);
+ return cb(err);
});
};
@@ -861,7 +854,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
if (!password) return cb('no password');
if (!wallet.checkPassword(password)) return cb('wrong password');
-
+
return cb(null, password);
});
@@ -956,8 +949,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp);
- root.openStatusModal(type, broadcastedTxp, function() {
- });
+ root.openStatusModal(type, broadcastedTxp, function() {});
return cb(null, broadcastedTxp)
});
@@ -965,8 +957,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, signedTxp);
- root.openStatusModal(type, signedTxp, function() {
- });
+ root.openStatusModal(type, signedTxp, function() {});
return cb(null, signedTxp);
}
});