mirror of https://github.com/BTCPrivate/copay.git
fix
This commit is contained in:
parent
d669f86c7d
commit
0d81cf8e9c
|
@ -53,6 +53,14 @@ angular.module('copayApp.services')
|
||||||
return cb();
|
return cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.addMetadata = function(b, opts) {
|
||||||
|
|
||||||
|
b = JSON.parse(b);
|
||||||
|
if (opts.historyCache) b.historyCache = opts.historyCache;
|
||||||
|
if (opts.addressBook) b.addressBook = opts.addressBook;
|
||||||
|
return JSON.stringify(b);
|
||||||
|
}
|
||||||
|
|
||||||
root.walletExport = function(password, opts) {
|
root.walletExport = function(password, opts) {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -61,6 +69,8 @@ angular.module('copayApp.services')
|
||||||
try {
|
try {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
var b = fc.export(opts);
|
var b = fc.export(opts);
|
||||||
|
if (opts.historyCache || opts.addressBook) b = root.addMetadata(b, opts);
|
||||||
|
|
||||||
var e = sjcl.encrypt(password, b, {
|
var e = sjcl.encrypt(password, b, {
|
||||||
iter: 10000
|
iter: 10000
|
||||||
});
|
});
|
||||||
|
@ -82,4 +92,4 @@ angular.module('copayApp.services')
|
||||||
_download(ew, filename, cb)
|
_download(ew, filename, cb)
|
||||||
};
|
};
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
|
@ -338,9 +338,10 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setMetaData = function(walletClient, addressBook, historyCache, cb) {
|
root.setMetaData = function(walletClient, addressBook, historyCache, cb) {
|
||||||
storageService.setAddressbook(walletClient.credentials.network, addressBook, function(err) {
|
|
||||||
|
storageService.setAddressbook(walletClient.credentials.network, JSON.stringify(addressBook), function(err) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
storageService.setTxHistory(historyCache, walletClient.credentials.walletId, function(err) {
|
storageService.setTxHistory(JSON.stringify(historyCache), walletClient.credentials.walletId, function(err) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
return cb(null);
|
return cb(null);
|
||||||
});
|
});
|
||||||
|
@ -393,6 +394,9 @@ angular.module('copayApp.services')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return cb(gettext('Could not import. Check input file and password'));
|
return cb(gettext('Could not import. Check input file and password'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str = JSON.parse(str);
|
||||||
|
|
||||||
var addressBook = str.addressBook || [];
|
var addressBook = str.addressBook || [];
|
||||||
var historyCache = str.historyCache || [];
|
var historyCache = str.historyCache || [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue