Added Storage#readWallet and used this from WalletFactory

This commit is contained in:
Ivan Socolsky 2014-09-23 10:16:26 -03:00
commit 0f37ea1929
4 changed files with 105 additions and 63 deletions

View file

@ -153,10 +153,10 @@ WalletFactory.prototype.read = function(walletId, skipFields, cb) {
err;
var obj = {};
this.storage.getMany(walletId, Wallet.PERSISTED_PROPERTIES, function(ret) {
for (var ii in ret) {
obj[ii] = ret[ii];
}
this.storage.readWallet(walletId, function(ret) {
_.each(Wallet.PERSISTED_PROPERTIES, function(p) {
obj[p] = ret[p];
});
if (!_.any(_.values(obj)))
return cb(new Error('Wallet not found'));