decodeAddr method
Decodes a given blockchain address string.
Throws AddressConverterException on invalid input.
Implementation
@override
BuBytes decodeAddr(String addr, {String? hrp}) {
hrp = AddrKeyValidator.getAddrArg<String>(hrp, "hrp");
final decoded = SegwitBech32Decoder.decode(hrp, addr);
final witVerGot = decoded.$1;
final addrDecBytes = decoded.$2;
if (witVerGot != P2WPKHAddrConst.witnessVer) {
throw CoreErrors.addressValidationFailed(
reason: "Invalid address witness version",
);
}
return addrDecBytes;
}