Browse Source

simplify wallet object

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
441401987a
  1. 9
      lib/model/wallet.js

9
lib/model/wallet.js

@ -3,8 +3,6 @@
var _ = require('lodash'); var _ = require('lodash');
var Copayer = require('./copayer'); var Copayer = require('./copayer');
var Bitcore = require('bitcore');
var PublicKey = Bitcore.PublicKey;
var WALLET_VERSION = '1.0.0'; var WALLET_VERSION = '1.0.0';
function Wallet(opts) { function Wallet(opts) {
@ -20,9 +18,7 @@ function Wallet(opts) {
this.addressIndex = 0; this.addressIndex = 0;
this.copayers = []; this.copayers = [];
this.version = WALLET_VERSION; this.version = WALLET_VERSION;
this.pubKey = opts.pubKey;
if (opts.pubKey)
this.pubKey = new PublicKey(opts.pubKey);
}; };
@ -49,8 +45,7 @@ Wallet.fromObj = function (obj) {
x.copayers = _.map(obj.copayers, function (copayer) { x.copayers = _.map(obj.copayers, function (copayer) {
return new Copayer(copayer); return new Copayer(copayer);
}); });
x.pubKey = new PublicKey(obj.pubKey); x.pubKey = obj.pubKey;
return x; return x;
}; };

Loading…
Cancel
Save