rotate method
Future<String>
rotate({
- required Identifier controller,
- required List<
PublicKey> currentKeys, - required List<
PublicKey> newNextKeys, - required List<
String> witnessToAdd, - required List<
String> witnessToRemove, - required int witnessThreshold,
- dynamic hint,
override
Creates rotation event that needs to be signed externally.
Implementation
@override
Future<String> rotate(
{required Identifier controller,
required List<PublicKey> currentKeys,
required List<PublicKey> newNextKeys,
required List<String> witnessToAdd,
required List<String> witnessToRemove,
required int witnessThreshold,
dynamic hint}) async {
try {
return await api.rotate(
identifier: controller,
currentKeys: currentKeys,
newNextKeys: newNextKeys,
witnessToAdd: witnessToAdd,
witnessToRemove: witnessToRemove,
witnessThreshold: witnessThreshold);
} on FfiException catch (e) {
if (e.message.contains('Can\'t parse controller')) {
throw IdentifierException(
'Can\'t parse controller prefix. Check the confroller for identifier once again.');
}
if (e.message.contains('base64 decode error')) {
throw IncorrectKeyFormatException(
"The provided key is not a Base64 string. Check the string once again.");
}
if (e.message.contains('Can\'t parse witness identifier')) {
throw WitnessParsingException(
'Can\'t parse witness identifier. Check the wittnessToRemove field.');
}
if (e.message.contains('network error')) {
throw OobiResolvingErrorException(
"No service is listening under the provided port number. Consider changing it.");
}
if (e.message.contains('Improper witness prefix')) {
throw ImproperWitnessPrefixException(
"Improper witness prefix, should be basic prefix. Check the eid field.");
}
if (e.message.contains('Unknown id')) {
throw IdentifierException(
'Unknown controller identifier. Check the confroller for identifier once again.');
}
if (e.message.contains('Can\'t parse oobi json')) {
throw IncorrectOobiException(
'Provided oobi is incorrect. Please check the JSON once again');
}
rethrow;
}
}