decodeAddr method
Overrides the base class method to decode a P2WPKH address.
Implementation
@override
List<int> decodeAddr(String addr, {String? hrp}) {
hrp = AddrKeyValidator.getAddrArg<String>(hrp, "hrp");
/// Decode the Bech32-encoded P2WPKH address, and validate its length.
final decoded = SegwitBech32Decoder.decode(hrp, addr);
final witVerGot = decoded.$1;
final addrDecBytes = decoded.$2;
/// Check the witness version.
if (witVerGot != P2WPKHAddrConst.witnessVer) {
throw AddressConverterException.addressValidationFailed(
reason: "Invalid address checksum",
);
}
/// Return the decoded P2WPKH address as a `List<int>`.
return addrDecBytes;
}