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);
if (network != null && decode.network != network) {
throw ADAPluginException(
'Incorrect address network. ',
details: {'expected': network.name, 'network': decode.network.name},
);
}
if (decode.type == ADAAddressType.byron) {
throw ADAPluginException(
'Invalid shelly address.',
details: {'address': address, 'type': decode.type},
);
}
if (keepPrefix) {
return decode.addressBytes;
}
return decode.addressBytes.sublist(decode.prefixBytes!.length);
}