refactor code
This commit is contained in:
parent
7da4c7925a
commit
21266570d4
@ -365,6 +365,15 @@ HDPrivateKey.fromSeed = function(hexa, network) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HDPrivateKey.prototype._calcHDPublicKey = function() {
|
||||||
|
if (!this._hdPublicKey) {
|
||||||
|
var HDPublicKey = require('./hdpublickey');
|
||||||
|
this._hdPublicKey = new HDPublicKey(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives a object with buffers in all the properties and populates the
|
* Receives a object with buffers in all the properties and populates the
|
||||||
* internal structure
|
* internal structure
|
||||||
@ -424,14 +433,12 @@ HDPrivateKey.prototype._buildFromBuffers = function(arg) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this._hdPublicKey = null;
|
this._hdPublicKey = null;
|
||||||
|
|
||||||
Object.defineProperty(this, 'hdPublicKey', {
|
Object.defineProperty(this, 'hdPublicKey', {
|
||||||
configurable: false,
|
configurable: false,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function() {
|
get: function() {
|
||||||
if (!this._hdPublicKey) {
|
this._calcHDPublicKey();
|
||||||
var HDPublicKey = require('./hdpublickey');
|
|
||||||
this._hdPublicKey = new HDPublicKey(this);
|
|
||||||
}
|
|
||||||
return this._hdPublicKey;
|
return this._hdPublicKey;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -439,10 +446,7 @@ HDPrivateKey.prototype._buildFromBuffers = function(arg) {
|
|||||||
configurable: false,
|
configurable: false,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function() {
|
get: function() {
|
||||||
if (!this._hdPublicKey) {
|
this._calcHDPublicKey();
|
||||||
var HDPublicKey = require('./hdpublickey');
|
|
||||||
this._hdPublicKey = new HDPublicKey(this);
|
|
||||||
}
|
|
||||||
return this._hdPublicKey.xpubkey;
|
return this._hdPublicKey.xpubkey;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user