src/utils/bech32.js
function encode(hrp, version, hash) {
  const output = POOL65;

  if (version < 0 || version > 16)
    throw new Error('Invalid bech32 version.');

  if (hash.length < 2 || hash.length > 40)
    throw new Error('Invalid bech32 data length.');

  const data = convert(hash, output, 8, 5, version, 0);

  return serialize(hrp, data);
}
function encode(hrp, version, hash) {
  const output = POOL65;

  if (version < 0 || version > 16)
    throw new Error('Invalid bech32 version.');

  if (hash.length < 2 || hash.length > 40)
    throw new Error('Invalid bech32 data length.');

  const data = convert(hash, output, 8, 5, version, 0);

  return serialize(hrp, data);
}
function encode ( hrp , version , hash ) { const output = POOL65 ; if ( version < 0 || version > 16 ) throw new Error ( 'Invalid bech32 version.' ) ; if ( hash . length < 2 || hash . length > 40 ) throw new Error ( 'Invalid bech32 data length.' ) ; const data = convert ( hash , output , 8 , 5 , version , 0 ) ; return serialize ( hrp , data ) ; }
Serialize data to bech32 address.
@param {String} hrp
@param {Number} version
@param {Buffer} hash
@returns {String}
Serialize data to bech32 address .