diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 85e3ac820..2d1786d92 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -533,13 +533,14 @@ Wallet.prototype.toObj = function() { // fromObj => from a trusted source Wallet.fromObj = function(o, storage, network, blockchain) { var opts = JSON.parse(JSON.stringify(o.opts)); + opts.addressBook = o.addressBook; if (o.privateKey) opts.privateKey = PrivateKey.fromObj(o.privateKey); else opts.privateKey = new PrivateKey({ - networkName: this.networkName + networkName: opts.networkName }); if (o.publicKeyRing) diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index cee830506..b937fa259 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -55,11 +55,14 @@ WalletFactory.prototype.fromObj = function(obj, skipFields) { // not stored options obj.opts.reconnectDelay = this.walletDefaults.reconnectDelay; + // this is only used if private key or public key ring is skipped + obj.opts.networkName = this.networkName; + skipFields = skipFields || []; skipFields.forEach(function(k){ - if (obj[k]) + if (obj[k]) { delete obj[k]; - else + } else throw new Error('unknown field:' + k); });