getNip65DataSingle function
reads the latest nip65 data from cache
pubkey
pubkey you want nip65 data for
cacheManger
the cache manager you want to use
Implementation
Future<Nip65> getNip65DataSingle(
String pubkey, CacheManager cacheManager) async {
final data = await getNip65Data([pubkey], cacheManager);
// default
if (data.isEmpty) {
log(
"WARN: using default bootstrap relays as nip65 data!",
level: Level.warning.value,
);
// list to map
Map<String, ReadWriteMarker> newReadWrite = {};
for (var relay in DEFAULT_BOOTSTRAP_RELAYS) {
newReadWrite[relay] = ReadWriteMarker.readWrite;
}
return Nip65.fromMap(pubkey, newReadWrite);
}
return data[0];
}