convert static method

String convert(
  1. String address,
  2. String hrp,
  3. List<int>? netVer
)

Convert a Bitcoin Cash address by changing its HRP and net version.

Implementation

static String convert(String address, String hrp, List<int>? netVer) {
  // Decode address
  final decode = BchBech32Decoder.decode(
      address.substring(0, address.indexOf(":")), address);
  final currNetVer = decode.item1;
  final data = decode.item2;
  // Encode again with new HRP and net version
  return BchBech32Encoder.encode(hrp, netVer ?? currNetVer, data);
}