ndk_sembast
A Sembast cache manager and wallets repository for NDK, in pure Dart.
SembastCacheManagerpersists the NDK cache, in a database file on native platforms and in IndexedDB on the web.SembastWalletsRepopersists wallets.SembastWalletsRepo.createopens a database file, so it is native only; on the web, pass an opened Sembast database to the constructor.- No Flutter required.
Usage
import 'package:ndk/ndk.dart';
import 'package:ndk_sembast/ndk_sembast.dart';
// databasePath is required on native platforms and ignored on the web.
final cache = await SembastCacheManager.create(databasePath: '/path/to/db');
final walletsRepo = await SembastWalletsRepo.create(filename: 'wallets.db');
final ndk = Ndk(
NdkConfig(
cache: cache,
walletsRepo: walletsRepo,
eventVerifier: Bip340EventVerifier(),
),
);
// ...
await ndk.destroy();
await cache.close();
await walletsRepo.close();
More in example/.