mirror of https://github.com/BTCPrivate/copay.git
allow recreate
This commit is contained in:
parent
d6d54a4e35
commit
d0d4f85c59
|
@ -19,6 +19,11 @@
|
||||||
<button class="outline white tiny round" translate>Tap to retry</button>
|
<button class="outline white tiny round" translate>Tap to retry</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="m20t" ng-show="walletNotRegistered" ng-click='recreate()'>
|
||||||
|
<span class="size-12 db m10b" translate>This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information.</span>
|
||||||
|
<button class="outline white tiny round" translate>Recreate</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ng-show="wallet.walletScanStatus == 'error'" ng-click='retryScan()'>
|
<div ng-show="wallet.walletScanStatus == 'error'" ng-click='retryScan()'>
|
||||||
<span translate>Scan status finished with error</span>
|
<span translate>Scan status finished with error</span>
|
||||||
<br><span translate>Tap to retry</span>
|
<br><span translate>Tap to retry</span>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
'use strict';
|
'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 HISTORY_SHOW_LIMIT = 10;
|
||||||
var currentTxHistoryPage;
|
var currentTxHistoryPage;
|
||||||
var wallet;
|
var wallet;
|
||||||
|
@ -65,14 +70,19 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$scope.updateStatus = function(force) {
|
$scope.updateStatus = function(force) {
|
||||||
$scope.updatingStatus = true;
|
$scope.updatingStatus = true;
|
||||||
$scope.updateStatusError = false;
|
$scope.updateStatusError = false;
|
||||||
|
$scope.walletNotRegistered = false;
|
||||||
|
|
||||||
walletService.getStatus(wallet, {
|
walletService.getStatus(wallet, {
|
||||||
force: !!force,
|
force: !!force,
|
||||||
}, function(err, status) {
|
}, function(err, status) {
|
||||||
$scope.updatingStatus = false;
|
$scope.updatingStatus = false;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (err === 'WALLET_NOT_REGISTERED') {
|
||||||
|
$scope.walletNotRegistered = true;
|
||||||
|
} else {
|
||||||
|
$scope.updateStatusError = true;
|
||||||
|
}
|
||||||
$scope.status = null;
|
$scope.status = null;
|
||||||
$scope.updateStatusError = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +150,15 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.recreate = function() {
|
$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) {
|
$scope.updateTxHistory = function(cb) {
|
||||||
|
@ -158,7 +176,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
|
@ -7,31 +7,31 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
||||||
var ongoingProcess = {};
|
var ongoingProcess = {};
|
||||||
|
|
||||||
var processNames = {
|
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'),
|
'broadcastingTx': gettext('Broadcasting transaction'),
|
||||||
'rejectTx': gettext('Rejecting payment proposal'),
|
|
||||||
'removeTx': gettext('Deleting payment proposal'),
|
|
||||||
'fetchingPayPro': gettext('Fetching Payment Information'),
|
|
||||||
'calculatingFee': gettext('Calculating fee'),
|
'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...'),
|
'connectingCoinbase': gettext('Connecting to Coinbase...'),
|
||||||
'connectingGlidera': gettext('Connecting to Glidera...'),
|
'connectingGlidera': gettext('Connecting to Glidera...'),
|
||||||
'importingWallet': gettext('Importing Wallet...'),
|
'connectingledger': gettext('Waiting for Ledger...'),
|
||||||
'sweepingWallet': gettext('Sweeping Wallet...'),
|
'connectingtrezor': gettext('Waiting for Trezor...'),
|
||||||
|
'creatingTx': gettext('Creating transaction'),
|
||||||
|
'creatingWallet': gettext('Creating Wallet...'),
|
||||||
'deletingWallet': gettext('Deleting Wallet...'),
|
'deletingWallet': gettext('Deleting Wallet...'),
|
||||||
'extractingWalletInfo': gettext('Extracting Wallet Information...'),
|
'extractingWalletInfo': gettext('Extracting Wallet Information...'),
|
||||||
|
'fetchingPayPro': gettext('Fetching Payment Information'),
|
||||||
|
'generatingCSV': gettext('Generating .csv file...'),
|
||||||
'gettingFeeLevels': gettext('Getting fee levels...'),
|
'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() {
|
root.clear = function() {
|
||||||
|
|
|
@ -10,6 +10,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
root.SOFT_CONFIRMATION_LIMIT = 12;
|
root.SOFT_CONFIRMATION_LIMIT = 12;
|
||||||
root.SAFE_CONFIRMATIONS = 6;
|
root.SAFE_CONFIRMATIONS = 6;
|
||||||
|
|
||||||
|
var errors = bwcService.getErrors();
|
||||||
|
|
||||||
// UI Related
|
// UI Related
|
||||||
root.openStatusModal = function(type, txp, cb) {
|
root.openStatusModal = function(type, txp, cb) {
|
||||||
var scope = $rootScope.$new(true);
|
var scope = $rootScope.$new(true);
|
||||||
|
@ -175,6 +177,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
twoStep: true
|
twoStep: true
|
||||||
}, function(err, ret) {
|
}, function(err, ret) {
|
||||||
if (err) {
|
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(bwcError.msg(err, gettext('Could not update Wallet')));
|
||||||
}
|
}
|
||||||
return cb(null, ret);
|
return cb(null, ret);
|
||||||
|
@ -296,7 +301,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSavedTxs = function(walletId, cb) {
|
var getSavedTxs = function(walletId, cb) {
|
||||||
|
|
||||||
storageService.getTxHistory(walletId, function(err, txs) {
|
storageService.getTxHistory(walletId, function(err, txs) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
@ -671,41 +675,30 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// walletHome
|
|
||||||
root.recreate = function(wallet, cb) {
|
root.recreate = function(wallet, cb) {
|
||||||
|
$log.debug('Recreating wallet:', wallet.id);
|
||||||
ongoingProcess.set('recreating', true);
|
ongoingProcess.set('recreating', true);
|
||||||
wallet.recreateWallet(function(err) {
|
wallet.recreateWallet(function(err) {
|
||||||
wallet.notAuthorized = false;
|
wallet.notAuthorized = false;
|
||||||
ongoingProcess.set('recreating', false);
|
ongoingProcess.set('recreating', false);
|
||||||
|
return cb(err);
|
||||||
if (err) {
|
|
||||||
handleError(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.startScan(wallet);
|
|
||||||
|
|
||||||
// TODO TODO TODO TODO:
|
|
||||||
// Do it on the controller
|
|
||||||
// profileService.bindWalletClient(wallet, {
|
|
||||||
// force: true
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.startScan = function(wallet) {
|
root.startScan = function(wallet, cb) {
|
||||||
$log.debug('Scanning wallet ' + wallet.credentials.walletId);
|
cb = cb || function() {};
|
||||||
|
|
||||||
|
$log.debug('Scanning wallet ' + wallet.id);
|
||||||
if (!wallet.isComplete()) return;
|
if (!wallet.isComplete()) return;
|
||||||
|
|
||||||
// wallet.updating = true;
|
wallet.updating = true;
|
||||||
|
ongoingProcess.set('scanning', true);
|
||||||
wallet.startScan({
|
wallet.startScan({
|
||||||
includeCopayerBranches: true,
|
includeCopayerBranches: true,
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
|
wallet.updating = false;
|
||||||
if (err && wallet.walletId == walletId) {
|
ongoingProcess.set('scanning', false);
|
||||||
wallet.updating = false;
|
return cb(err);
|
||||||
handleError(err);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -956,8 +949,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
|
|
||||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||||
var type = root.getViewStatus(wallet, broadcastedTxp);
|
var type = root.getViewStatus(wallet, broadcastedTxp);
|
||||||
root.openStatusModal(type, broadcastedTxp, function() {
|
root.openStatusModal(type, broadcastedTxp, function() {});
|
||||||
});
|
|
||||||
|
|
||||||
return cb(null, broadcastedTxp)
|
return cb(null, broadcastedTxp)
|
||||||
});
|
});
|
||||||
|
@ -965,8 +957,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||||
|
|
||||||
var type = root.getViewStatus(wallet, signedTxp);
|
var type = root.getViewStatus(wallet, signedTxp);
|
||||||
root.openStatusModal(type, signedTxp, function() {
|
root.openStatusModal(type, signedTxp, function() {});
|
||||||
});
|
|
||||||
return cb(null, signedTxp);
|
return cb(null, signedTxp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue