update to use pkr.networkName

This commit is contained in:
Matias Alejo Garcia 2014-06-09 18:01:15 -03:00
commit 8e8bf1fb84
4 changed files with 14 additions and 8 deletions

View file

@ -20,7 +20,7 @@ function Wallet(opts) {
['storage', 'network', 'blockchain',
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
'publicKeyRing', 'txProposals', 'privateKey', 'version',
'reconnectDelay', 'networkName'
'reconnectDelay'
].forEach(function(k) {
if (typeof opts[k] === 'undefined')
throw new Error('missing required option for Wallet: ' + k);
@ -174,6 +174,11 @@ Wallet.prototype._handleDisconnect = function(peerID) {
this.emit('disconnect', peerID);
};
Wallet.prototype.getNetworkName = function() {
return this.publicKeyRing.network.name;
};
Wallet.prototype._optsToObj = function() {
var obj = {
id: this.id,
@ -181,7 +186,6 @@ Wallet.prototype._optsToObj = function() {
requiredCopayers: this.requiredCopayers,
totalCopayers: this.totalCopayers,
reconnectDelay: this.reconnectDelay,
networkName: this.networkName,
name: this.name,
netKey: this.netKey,
version: this.version,

View file

@ -115,7 +115,6 @@ WalletFactory.prototype.create = function(opts) {
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
opts.reconnectDelay = opts.reconnectDelay || this.walletDefaults.reconnectDelay;
opts.networkName = opts.networkName || this.networkName;
opts.requiredCopayers = requiredCopayers;
opts.totalCopayers = totalCopayers;
opts.version = opts.version || this.version;
@ -163,7 +162,7 @@ WalletFactory.prototype.open = function(walletId, opts) {
var w = this.read(walletId);
if (w) {
this._checkVersion(w.version);
this._checkNetwork(w.networkName);
this._checkNetwork(w.getNetworkName());
w.store();
}
return w;
@ -188,8 +187,7 @@ WalletFactory.prototype.decodeSecret = function(secret) {
} catch (e) {
return false;
}
}
};
WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, cb) {
var self = this;