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