|
|
@ -41,8 +41,8 @@ function HDPublicKey(arg) { |
|
|
|
var error = HDPublicKey.getSerializedError(arg); |
|
|
|
if (!error) { |
|
|
|
return this._buildFromSerialized(arg); |
|
|
|
} else if (jsUtil.isValidJson(arg)) { |
|
|
|
return this._buildFromJson(arg); |
|
|
|
} else if (jsUtil.isValidJSON(arg)) { |
|
|
|
return this._buildFromJSON(arg); |
|
|
|
} else { |
|
|
|
if (error instanceof hdErrors.ArgumentIsPrivateExtended) { |
|
|
|
return new HDPrivateKey(arg).hdPublicKey; |
|
|
@ -211,7 +211,7 @@ HDPublicKey._validateNetwork = function (data, networkArg) { |
|
|
|
return null; |
|
|
|
}; |
|
|
|
|
|
|
|
HDPublicKey.prototype._buildFromJson = function (arg) { |
|
|
|
HDPublicKey.prototype._buildFromJSON = function (arg) { |
|
|
|
return this._buildFromObject(JSON.parse(arg)); |
|
|
|
}; |
|
|
|
|
|
|
@ -366,7 +366,7 @@ HDPublicKey.prototype.toString = function () { |
|
|
|
* * xpubkey: the string with the base58 representation of this extended key |
|
|
|
* * checksum: the base58 checksum of xpubkey |
|
|
|
*/ |
|
|
|
HDPublicKey.prototype.toObject = function () { |
|
|
|
HDPublicKey.prototype.toJSON = function () { |
|
|
|
return { |
|
|
|
network: Network.get(bufferUtil.integerFromBuffer(this._buffers.version)).name, |
|
|
|
depth: bufferUtil.integerFromSingleByteBuffer(this._buffers.depth), |
|
|
@ -380,16 +380,6 @@ HDPublicKey.prototype.toObject = function () { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns the JSON representation of this key's <tt>toObject</tt> result |
|
|
|
* |
|
|
|
* @see {HDPublicKey#toObject} |
|
|
|
* @return {string} |
|
|
|
*/ |
|
|
|
HDPublicKey.prototype.toJson = function () { |
|
|
|
return JSON.stringify(this.toObject()); |
|
|
|
}; |
|
|
|
|
|
|
|
HDPublicKey.Hardened = 0x80000000; |
|
|
|
HDPublicKey.RootElementAlias = ['m', 'M']; |
|
|
|
|
|
|
|