getChainsFromRecap static method
Implementation
static List<String> getChainsFromRecap(String recap) {
final decodedRecap = decodeRecap(recap);
if (!isValidRecap(decodedRecap)) return [];
final List<dynamic> recapChains = [];
try {
final att =
decodedRecap['att'] as Map<String, dynamic>? ?? <String, dynamic>{};
for (var resources in att.values) {
final resourcesMap = resources as Map<String, dynamic>;
final resourcesValues = resourcesMap.values.first as List;
for (var value in resourcesValues) {
final chainValues = value as Map<String, dynamic>;
final chains = chainValues['chains'] as List;
recapChains.addAll(chains);
}
}
return recapChains.map((e) => e.toString()).toSet().toList();
} catch (e) {
return [];
}
}