decodeAddr method
BuBytes
decodeAddr(
- String addr, {
- List<
int> ? netVersion, - Base58Alphabets alphabet = Base58Alphabets.bitcoin,
override
Decodes a given blockchain address string.
Throws AddressConverterException on invalid input.
Implementation
@override
BuBytes decodeAddr(
String addr, {
List<int>? netVersion,
Base58Alphabets alphabet = Base58Alphabets.bitcoin,
}) {
final List<int> netVarBytes = AddrKeyValidator.getAddrArg(
netVersion,
"netVersion",
);
// Decode with the given Base58 alphabet.
final List<int> addrDecBytes = Base58Decoder.decodeWithChecksum(
addr,
alphabet,
);
AddrDecUtils.validateBytesLength(
addrDecBytes,
QuickCrypto.hash160DigestSize + netVarBytes.length,
);
// Strip and validate the network version prefix.
return BuBytes(
AddrDecUtils.validateAndRemovePrefixBytes(addrDecBytes, netVarBytes),
);
}