encodeBech32Address static method

String encodeBech32Address({
  1. required List<int> bytes,
  2. required String hrp,
  3. required ZCashAddressType type,
})

Implementation

static String encodeBech32Address({
  required List<int> bytes,
  required String hrp,
  required ZCashAddressType type,
}) {
  assert([ZCashAddressType.sapling, ZCashAddressType.tex].contains(type));
  if (bytes.length != type.lengthInBytes) {
    throw AddressConverterException.addressBytesValidationFailed(
      reason: "Invalid address bytes length.",
    );
  }
  return ZCashEncodingUtils.encodeBech32Address(
    bytes: bytes,
    hrp: hrp,
    encoding:
        type == ZCashAddressType.tex
            ? Bech32Encodings.bech32m
            : Bech32Encodings.bech32,
  );
}