encode method

String encode(
  1. Chain chain
)

Encode the payload as an MWEB address using chain.mwebHrp. Provided primarily for round-trip testing; in production MWEB addresses come from mwebd.

Implementation

String encode(Chain chain) {
  final hrpToUse = chain.mwebHrp;
  if (hrpToUse == null) {
    throw FormatException('Chain does not support MWEB addresses');
  }
  return _bech32EncodeRaw(hrpToUse, payload);
}