delete focused wallet
This commit is contained in:
parent
5b14c8aca3
commit
6e4a1e7ff2
28 changed files with 184 additions and 194 deletions
|
|
@ -1,11 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('addressbookService', function(storageService, profileService, lodash) {
|
||||
angular.module('copayApp.services').factory('addressbookService', function($stateParams, storageService, profileService, lodash) {
|
||||
var root = {};
|
||||
|
||||
root.getLabel = function(addr, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
storageService.getAddressbook(fc.credentials.network, function(err, ab) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
storageService.getAddressbook(wallet.credentials.network, function(err, ab) {
|
||||
if (!ab) return cb();
|
||||
if (ab[addr]) return cb(ab[addr]);
|
||||
else return cb();
|
||||
|
|
@ -23,19 +23,19 @@ angular.module('copayApp.services').factory('addressbookService', function(stora
|
|||
if (ab2) ab2 = JSON.parse(ab2);
|
||||
|
||||
ab2 = ab2 || {};
|
||||
return cb(err, lodash.defaults(ab2,ab));
|
||||
return cb(err, lodash.defaults(ab2, ab));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.add = function(entry, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
root.list(function(err, ab) {
|
||||
if (err) return cb(err);
|
||||
if (!ab) ab = {};
|
||||
if (ab[entry.address]) return cb('Entry already exist');
|
||||
ab[entry.address] = entry.label;
|
||||
storageService.setAddressbook(fc.credentials.network, JSON.stringify(ab), function(err, ab) {
|
||||
storageService.setAddressbook(wallet.credentials.network, JSON.stringify(ab), function(err, ab) {
|
||||
if (err) return cb('Error adding new entry');
|
||||
root.list(function(err, ab) {
|
||||
return cb(err, ab);
|
||||
|
|
@ -43,26 +43,26 @@ angular.module('copayApp.services').factory('addressbookService', function(stora
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
root.remove = function(addr, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
root.list(function(err, ab) {
|
||||
if (err) return cb(err);
|
||||
if (!ab) return;
|
||||
if (!ab[addr]) return cb('Entry does not exist');
|
||||
delete ab[addr];
|
||||
storageService.setAddressbook(fc.credentials.network, JSON.stringify(ab), function(err) {
|
||||
storageService.setAddressbook(wallet.credentials.network, JSON.stringify(ab), function(err) {
|
||||
if (err) return cb('Error deleting entry');
|
||||
root.list(function(err, ab) {
|
||||
return cb(err, ab);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.removeAll = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
storageService.removeAddressbook(fc.credentials.network, function(err) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
storageService.removeAddressbook(wallet.credentials.network, function(err) {
|
||||
if (err) return cb('Error deleting addressbook');
|
||||
return cb();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('backupService', function backupServiceFactory($log, $timeout, profileService, sjcl) {
|
||||
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -57,10 +57,10 @@ angular.module('copayApp.services')
|
|||
if (!password) {
|
||||
return null;
|
||||
}
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
try {
|
||||
opts = opts || {};
|
||||
var b = fc.export(opts);
|
||||
var b = wallet.export(opts);
|
||||
if (opts.addressBook) b = root.addMetadata(b, opts);
|
||||
|
||||
var e = sjcl.encrypt(password, b, {
|
||||
|
|
@ -74,11 +74,11 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
root.walletDownload = function(password, opts, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var ew = root.walletExport(password, opts);
|
||||
if (!ew) return cb('Could not create backup');
|
||||
|
||||
var walletName = (fc.alias || '') + (fc.alias ? '-' : '') + fc.credentials.walletName;
|
||||
var walletName = (wallet.alias || '') + (wallet.alias ? '-' : '') + wallet.credentials.walletName;
|
||||
if (opts.noSign) walletName = walletName + '-noSign'
|
||||
var filename = walletName + '-Copaybackup.aes.json';
|
||||
_download(ew, filename, cb)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('feeService', function($log, bwcService, walletService, configService, gettext, lodash, txFormatService) {
|
||||
angular.module('copayApp.services').factory('feeService', function($log, $stateParams, bwcService, walletService, configService, gettext, lodash, txFormatService) {
|
||||
var root = {};
|
||||
|
||||
// Constant fee options to translate
|
||||
|
|
@ -16,12 +16,12 @@ angular.module('copayApp.services').factory('feeService', function($log, bwcServ
|
|||
};
|
||||
|
||||
root.getCurrentFeeValue = function(cb) {
|
||||
console.log('[feeService.js.18:getCurrentFeeValue:] TODO TODO TODO'); //TODO
|
||||
console.log('[feeService.js.18:getCurrentFeeValue:] TODO TODO TODO'); //TODO
|
||||
// TODO TODO TODO
|
||||
var fc = walletService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var feeLevel = root.getCurrentFeeLevel();
|
||||
|
||||
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
|
||||
wallet.getFeeLevels(wallet.credentials.network, function(err, levels) {
|
||||
if (err)
|
||||
return cb({
|
||||
message: 'Could not get dynamic fee'
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ angular.module('copayApp.services').factory('txStatus', function(lodash, profile
|
|||
var isCordova = platformInfo.isCordova;
|
||||
|
||||
root.notify = function(txp) {
|
||||
var fc = profileService.focusedClient;
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var status = txp.status;
|
||||
var type;
|
||||
var INMEDIATE_SECS = 10;
|
||||
|
|
@ -16,7 +16,7 @@ angular.module('copayApp.services').factory('txStatus', function(lodash, profile
|
|||
|
||||
var n = txp.actions.length;
|
||||
var action = lodash.find(txp.actions, {
|
||||
copayerId: fc.credentials.copayerId
|
||||
copayerId: wallet.credentials.copayerId
|
||||
});
|
||||
|
||||
if (!action) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue