decode static method
Implementation
static AtomAddressDecodeResult decode(String address, {String? hrp}) {
try {
final decode = Bech32Decoder.decodeWithoutHRP(address);
if (hrp != null && hrp != decode.item1) {
throw AddressConverterException(
"Invalid format (HRP not valid, expected {$hrp}, got {${decode.item1}})");
}
final addressBytes = decode.item2;
validateAddressBytes(addressBytes);
return AtomAddressDecodeResult(hrp: decode.item1, bytes: addressBytes);
} on AddressConverterException {
rethrow;
} catch (e) {
throw AddressConverterException("Invalid atom address.",
details: {"address": address, "error": e.toString()});
}
}