broadcastMetadata method
Implementation
Future<Metadata> broadcastMetadata(
Metadata metadata, {
Iterable<String>? specificRelays,
}) async {
_checkSigner();
Nip01Event? event = await _refreshMetadataEvent();
if (event != null) {
Map<String, dynamic> map = json.decode(event.content);
map.addAll(metadata.toJson());
event = Nip01Event(
pubKey: event.pubKey,
kind: event.kind,
tags: event.tags,
content: json.encode(map),
createdAt: Helpers.now);
} else {
event = metadata.toEvent();
}
// final bResult =
_broadcast.broadcast(
nostrEvent: event,
specificRelays: specificRelays,
);
//todo: implement publishDone
//await bResult.publishDone;
_broadcast.broadcast(
nostrEvent: event,
specificRelays: specificRelays,
);
metadata.updatedAt = Helpers.now;
metadata.refreshedTimestamp = Helpers.now;
await _cacheManager.saveMetadata(metadata);
return metadata;
}