function decodeCashAddress(address) {


  function hasSingleCase(string) {
    var lowerCase = string.toLowerCase();
    var upperCase = string.toUpperCase();
    var hasSingleCase  = string === lowerCase || string === upperCase;

    return hasSingleCase;
  }

  function validChecksum(prefix, payload) {
    function prefixToArray(prefix) {
      var result = [];
      for (var i=0; i<prefix.length; i++) {
        result.push(prefix.charCodeAt(i) & 31);
      }
      return result;
    }

    var prefixData = prefixToArray(prefix).concat([0]);
    return polymod(prefixData.concat(payload)) === 0;
  }

  $.checkArgument(hasSingleCase(address), 'Mixed case');
  address = address.toLowerCase();

  var pieces = address.split(':');
  $.checkArgument(pieces.length <= 2, 'Invalid format:'+ address);

  var prefix, encodedPayload;

  if (pieces.length === 2) {
    prefix = pieces[0];
    encodedPayload = pieces[1];
  } else {
    prefix = null;
    encodedPayload = pieces[0];
  }

  var payload = base32.decode(encodedPayload.toLowerCase());

  if (prefix) {
    $.checkArgument(validChecksum(prefix, payload), 'Invalid checksum:'+ address);
  } else {

    var netNames = ['livenet','testnet','regtest'];
    var i;

    while(!prefix && (i = netNames.shift())){
      var p  =  Networks.get(i).prefix;
      if(validChecksum(p, payload)) {
        prefix = p;
      }
    }
    $.checkArgument(prefix, 'Invalid checksum:'+ address);
  }

  var convertedBits = convertBits(payload.slice(0, -8), 5, 8, true);
  var versionByte = convertedBits.shift();
  var hash = convertedBits;

  $.checkArgument(getHashSize(versionByte) === hash.length * 8, 'Invalid hash size:'+ address);

  function getType(versionByte) {
    switch (versionByte & 120) {
    case 0:
      return 'pubkeyhash';
    case 8:
      return 'scripthash';
    default:
      throw new Error('Invalid address type in version byte:' + versionByte);
    }
  }


  var type = getType(versionByte);
  var network = Networks.get(prefix);
//console.log('[address.js.336:network:]',network); //TODO

  var info = {};

  //return { prefix, type, hash };
//console.log('[address.js.339]', hash); //TODO

  info.hashBuffer = Buffer.from(hash);
  info.network = network;
  info.type = type;
  return info;
}
Creates a P2SH Zero-Confirmation Escrow (ZCE) address from a set of input public keys and a reclaim public key.

@param {Array} inputPublicKeys - the set of public keys needed to sign all inputs in a ZCE transaction
@param {PublicKey} reclaimPublicKey - the public key required to reclaim the escrow
@param {String|Network} network - either a Network instance, 'livenet', or 'testnet'
@return {Address}