decodeAddr method
Decodes a given blockchain address string.
Throws AddressConverterException on invalid input.
Implementation
@override
List<int> decodeAddr(String addr, {List<int>? versionBytes}) {
final List<int> verBytes = AddrKeyValidator.getAddrArg(
versionBytes,
"versionBytes",
);
final List<int> addrDecBytes = Base58Decoder.decodeWithChecksum(addr);
AddrDecUtils.validateBytesLength(
addrDecBytes,
QuickCrypto.hash160DigestSize + verBytes.length,
);
if (!BytesUtils.bytesEqual([addrDecBytes[0]], verBytes)) {
throw CoreErrors.addressValidationFailed(
reason: "Invalid address version byte.",
);
}
return addrDecBytes.sublist(1);
}