encode static method

String encode(
  1. String hrp,
  2. int witVer,
  3. List<int> witProg
)

Encodes a Segregated Witness (SegWit) address using Bech32 encoding.

This method takes a Human-Readable Part (HRP), a SegWit version, and a witness program. It encodes them into a Bech32-encoded SegWit address.

  • hrp: The Human-Readable Part (prefix) for the address.
  • witVer: The SegWit version.
  • witProg: The witness program bytes.

Returns the Bech32-encoded SegWit address.

Implementation

static String encode(String hrp, int witVer, List<int> witProg) {
  return Bech32EncoderBase.encodeBech32(
      hrp,
      List<int>.from([witVer, ...Bech32BaseUtils.convertToBase32(witProg)]),
      SegwitBech32Const.separator,
      _computeChecksum);
}