crossmintRecoveryMethodMaps function
Every recovery method on the wallet, newest contract first.
Reads config.recoveryMethods and falls back to wrapping the deprecated
config.adminSigner for responses that predate the list or send the list
empty.
Implementation
List<CrossmintJsonMap> crossmintRecoveryMethodMaps(CrossmintWallet wallet) {
final Object? config = wallet.raw['config'];
if (config is! Map<Object?, Object?>) {
return const <CrossmintJsonMap>[];
}
final Object? methods = config['recoveryMethods'];
if (methods is List<Object?> && methods.isNotEmpty) {
return methods
.whereType<Map<Object?, Object?>>()
.map(crossmintNormalizeMap)
.toList(growable: false);
}
final Object? adminSigner = config['adminSigner'];
if (adminSigner is Map<Object?, Object?>) {
return <CrossmintJsonMap>[crossmintNormalizeMap(adminSigner)];
}
return const <CrossmintJsonMap>[];
}