function fromBech32(address) {
  let result;
  let version;
  try {
    result = bech32.decode(address);
  } catch (e) {}
  if (result) {
    version = result.words[0];
    if (version !== 0) throw new TypeError(address + ' uses wrong encoding');
  } else {
    result = bech32m.decode(address);
    version = result.words[0];
    if (version === 0) throw new TypeError(address + ' uses wrong encoding');
  }
  const data = bech32.fromWords(result.words.slice(1));
  return {
    version,
    prefix: result.prefix,
    data: Uint8Array.from(data),
  };
}
Converts a Bech32 or Bech32m encoded address to its corresponding data representation.
@param address - The Bech32 or Bech32m encoded address.
@returns An object containing the version, prefix, and data of the address.
@throws {TypeError} If the address uses the wrong encoding.