bitcore-lib-doge
Advanced tools
Comparing version 10.0.11 to 10.0.13
@@ -91,4 +91,4 @@ 'use strict'; | ||
* @param {*} data - The encoded data in various formats | ||
* @param {Network|String|number=} network - The network: 'livenet' or 'testnet' | ||
* @param {string=} type - The type of address: 'script' or 'pubkey' | ||
* @param {Network|string|number} network - The network: 'livenet' or 'testnet' | ||
* @param {string} type - The type of address: 'scripthash' or 'pubkeyhash' | ||
* @returns {Object} An "info" object with "type", "network", and "hashBuffer" | ||
@@ -104,3 +104,3 @@ */ | ||
} else if (data instanceof PublicKey) { | ||
return Address._transformPublicKey(data); | ||
return Address._transformPublicKey(data, network, type); | ||
} else if (data instanceof Script) { | ||
@@ -221,6 +221,8 @@ return Address._transformScript(data, network); | ||
* @param {PublicKey} pubkey - An instance of PublicKey | ||
* @param {string} network - mainnet, testnet, or regtest | ||
* @param {string} type - Either 'pubkeyhash' or 'scripthash' | ||
* @returns {Object} An object with keys: hashBuffer, type | ||
* @private | ||
*/ | ||
Address._transformPublicKey = function(pubkey) { | ||
Address._transformPublicKey = function(pubkey, network, type) { | ||
var info = {}; | ||
@@ -231,3 +233,3 @@ if (!(pubkey instanceof PublicKey)) { | ||
info.hashBuffer = Hash.sha256ripemd160(pubkey.toBuffer()); | ||
info.type = Address.PayToPublicKeyHash; | ||
info.type = type || Address.PayToPublicKeyHash; | ||
return info; | ||
@@ -292,7 +294,8 @@ }; | ||
* @param {PublicKey} data | ||
* @param {String|Network} network - either a Network instance, 'livenet', or 'testnet' | ||
* @param {string|Network} network - either a Network instance, 'livenet', or 'testnet' | ||
* @param {string} type - Either 'pubkeyhash' or 'scripthash' | ||
* @returns {Address} A new valid and frozen instance of an Address | ||
*/ | ||
Address.fromPublicKey = function(data, network) { | ||
var info = Address._transformPublicKey(data); | ||
Address.fromPublicKey = function(data, network, type) { | ||
var info = Address._transformPublicKey(data, network, type); | ||
network = network || Networks.defaultNetwork; | ||
@@ -299,0 +302,0 @@ return new Address(info.hashBuffer, network, info.type); |
@@ -365,8 +365,9 @@ 'use strict'; | ||
* | ||
* @param {String|Network=} network - Which network should the address be for | ||
* @param {string|Network} network - Which network should the address be for | ||
* @param {string} type - 'pubkeyhash' (default) or 'scripthash' | ||
* @returns {Address} An address generated from the public key | ||
*/ | ||
PublicKey.prototype.toAddress = function(network) { | ||
PublicKey.prototype.toAddress = function(network, type) { | ||
var Address = require('./address'); | ||
return Address.fromPublicKey(this, network || this.network); | ||
return Address.fromPublicKey(this, network || this.network, type); | ||
}; | ||
@@ -373,0 +374,0 @@ |
{ | ||
"name": "bitcore-lib-doge", | ||
"version": "10.0.11", | ||
"version": "10.0.13", | ||
"description": "A pure and powerful JavaScript Dogecoin library.", | ||
@@ -55,3 +55,3 @@ "author": "BitPay <dev@bitpay.com>", | ||
"license": "MIT", | ||
"gitHead": "bfe8e147cf8cc1bf1b4abe74aa4af06f03f94e18" | ||
"gitHead": "78af07dba16dc5bc7a84c7519e6d3df60c1ca37a" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3978110
86662