Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #463 +/- ##
==========================================
- Coverage 76.01% 75.90% -0.12%
==========================================
Files 152 152
Lines 6204 6216 +12
==========================================
+ Hits 4716 4718 +2
- Misses 1488 1498 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| final signer = Bip340EventSigner(privateKey: null, publicKey: publicKey); | ||
|
|
||
| Nip51List? list = | ||
| !forceRefresh ? await _getCachedNip51List(kind, signer) : null; |
There was a problem hiding this comment.
Can we refactor _getCachedNip51List to accept a pubkey as parameter ?
There was a problem hiding this comment.
not easy because Nip51List.fromEvent has the signer
There was a problem hiding this comment.
We can add the pubkey parameter and create the signer in _getCachedNip51List if it's not provided.
nogringo
left a comment
There was a problem hiding this comment.
We may need to refactor to wait all events and then sort them to save and return the newest.
what do you suggest? Saving all lists? |
Future<Nip51List?> getPublicList({
required int kind,
required String publicKey,
bool forceRefresh = false,
Duration timeout = const Duration(seconds: 5),
}) async {
final signer = Bip340EventSigner(privateKey: null, publicKey: publicKey);
Nip51List? list =
!forceRefresh ? await _getCachedNip51List(kind, signer) : null;
if (list != null) return list;
final events = await _requests.query(filters: [
Filter(
authors: [publicKey],
kinds: [kind],
limit: 1,
)
], timeout: timeout).future;
if (events.isEmpty) return null;
events.sort((a, b) => a.createdAt.compareTo(b.createdAt));
await _cacheManager.saveEvent(events.last);
return await Nip51List.fromEvent(events.last, signer);
}and we can use |
adds:
apparently we missed that