decodeShellyAddress static method
Decode an ADA Shelly address string to bytes.
address
: The address to decode.
network
: The network type.
keepPrefix
: Whether to keep the address prefix.
Returns a byte list representing the decoded address.
Implementation
static List<int> decodeShellyAddress(
String address, {
ADANetwork? network,
bool keepPrefix = true,
}) {
final decode =
AdaGenericAddrDecoder().decode(address, {"net_tag": network});
if (decode.type == ADAAddressType.byron) {
throw MessageException("Invalid shelly address.",
details: {"address": address, "type": decode.type});
}
if (keepPrefix) {
return decode.addressBytes;
}
return decode.addressBytes.sublist(decode.prefixBytes!.length);
}