packages/bitcoin-utils/lib/index.js
function pubKeyHashToAddress (pubKeyHash, network, type) {
  pubKeyHash = ensureBuffer(pubKeyHash)
  const prefixHash = Buffer.concat([Buffer.from(networks[network][type], 'hex'), pubKeyHash])
  const checksum = Buffer.from(sha256(sha256(prefixHash)).slice(0, 8), 'hex')
  const addr = base58.encode(Buffer.concat([prefixHash, checksum]).slice(0, 25))
  return addr
}
function pubKeyHashToAddress (pubKeyHash, network, type) {
  pubKeyHash = ensureBuffer(pubKeyHash)
  const prefixHash = Buffer.concat([Buffer.from(networks[network][type], 'hex'), pubKeyHash])
  const checksum = Buffer.from(sha256(sha256(prefixHash)).slice(0, 8), 'hex')
  const addr = base58.encode(Buffer.concat([prefixHash, checksum]).slice(0, 25))
  return addr
}
function pubKeyHashToAddress ( pubKeyHash , network , type ) { pubKeyHash = ensureBuffer ( pubKeyHash ) const prefixHash = Buffer . concat ( [ Buffer . from ( networks [ network ] [ type ] , 'hex' ) , pubKeyHash ] ) const checksum = Buffer . from ( sha256 ( sha256 ( prefixHash ) ) . slice ( 0 , 8 ) , 'hex' ) const addr = base58 . encode ( Buffer . concat ( [ prefixHash , checksum ] ) . slice ( 0 , 25 ) ) return addr }
Get address from pubKeyHash.
@param {!string} pubKeyHash - hash160 of pubKey.
@param {!string} network - bitcoin, testnet, or litecoin.
@param {!string} type - pubKeyHash or scriptHash.
@return {string} Returns the address derived from pubKeyHash.
Get address from pubKeyHash .