saveNip05 method
Future<void>
saveNip05(
- Nip05 nip05
)
override
Implementation
@override
Future<void> saveNip05(Nip05 nip05) async {
await dbRdy;
final box = _objectBox.store.box<DbNip05>();
final existing = box
.query(DbNip05_.pubKey.equals(nip05.pubKey))
.order(DbNip05_.networkFetchTime, flags: Order.descending)
.build()
.find();
if (existing.length > 1) {
box.removeMany(existing.map((e) => e.dbId).toList());
}
if (existing.isNotEmpty &&
nip05.networkFetchTime! < existing[0].networkFetchTime!) {
return;
}
box.put(DbNip05.fromNdk(nip05));
}