decodeAddr method
Blockchain address decoder for Ada Shelley addresses. This decoder is used to decode payment addresses based on the network tag and address format.
Implementation
@override
List<int> decodeAddr(String addr, {ADANetwork network = ADANetwork.mainnet}) {
// Decode the provided Bech32 address.
final addrDecBytes = Bech32Decoder.decode(
AdaShelleyAddrUtils.getAddressHrp(network),
addr,
);
/// Validate the byte length of the decoded address.
AddrDecUtils.validateBytesLength(
addrDecBytes,
(QuickCrypto.blake2b224DigestSize * 2) + 1,
);
/// Encode the address prefix based on the payment header type and network tag.
final prefixByte = AdaShelleyAddrUtils.encodePrefix(
ADAAddressType.base,
network.value,
AdaShelleyAddrUtils.decodeCred(addrDecBytes[0], 4),
stakeType: AdaShelleyAddrUtils.decodeCred(addrDecBytes[0], 5),
);
return AddrDecUtils.validateAndRemovePrefixBytes(addrDecBytes, prefixByte);
}