allow recreate
This commit is contained in:
parent
d6d54a4e35
commit
d0d4f85c59
4 changed files with 63 additions and 50 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue