From f0911caf63d76cbaac3eb55e32e88e1b6a0f28c6 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Mon, 28 Apr 2014 11:22:41 -0300 Subject: [PATCH 1/2] fixed errors to import/open wallets --- js/models/core/WalletFactory.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index 86c863d9c..5cedd56db 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -53,9 +53,9 @@ WalletFactory.prototype._checkRead = function(walletId) { WalletFactory.prototype.fromObj = function(obj) { var opts = obj.opts; - opts.publicKeyRing = new PublicKeyRing.fromObj(obj.publicKeyRing); - opts.txProposals = new TxProposals.fromObj(obj.txProposals); - opts.privateKey = new PrivateKey.fromObj(obj.privateKey); + opts['publicKeyRing'] = new PublicKeyRing.fromObj(obj.publicKeyRing); + opts['txProposals'] = new TxProposals.fromObj(obj.txProposals); + opts['privateKey'] = new PrivateKey.fromObj(obj.privateKey); opts.storage = this.storage; opts.network = this.network; opts.blockchain = this.blockchain; @@ -79,14 +79,16 @@ WalletFactory.prototype.read = function(walletId) { if (! this._checkRead(walletId)) return false; + var obj = {}; var s = this.storage; - var opts = s.get(walletId, 'opts'); - opts.id = walletId; - opts.publicKeyRing = s.get(walletId, 'publicKeyRing'); - opts.txProposals = s.get(walletId, 'txProposals'); - opts.privateKey = s.get(walletId, 'privateKey'); - w = this.formObj(opts); + obj.id = walletId; + obj.opts = s.get(walletId, 'opts'); + obj.publicKeyRing = s.get(walletId, 'publicKeyRing'); + obj.txProposals = s.get(walletId, 'txProposals'); + obj.privateKey = s.get(walletId, 'privateKey'); + + var w = this.fromObj(obj); return w; }; From 1168bf82b899d82802c160d97cacc3a58d6dff81 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Mon, 28 Apr 2014 11:32:02 -0300 Subject: [PATCH 2/2] obj syntax --- js/models/core/WalletFactory.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index 5cedd56db..5460907df 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -53,9 +53,9 @@ WalletFactory.prototype._checkRead = function(walletId) { WalletFactory.prototype.fromObj = function(obj) { var opts = obj.opts; - opts['publicKeyRing'] = new PublicKeyRing.fromObj(obj.publicKeyRing); - opts['txProposals'] = new TxProposals.fromObj(obj.txProposals); - opts['privateKey'] = new PrivateKey.fromObj(obj.privateKey); + opts.publicKeyRing = new PublicKeyRing.fromObj(obj.publicKeyRing); + opts.txProposals = new TxProposals.fromObj(obj.txProposals); + opts.privateKey = new PrivateKey.fromObj(obj.privateKey); opts.storage = this.storage; opts.network = this.network; opts.blockchain = this.blockchain;