ndk 0.3.2 copy "ndk: ^0.3.2" to clipboard
ndk: ^0.3.2 copied to clipboard

Nostr Development Kit - the most performant lib for all your nostr usecases

example/README.md

NDK #

➡️ DOCUMENTATION 🔗 #

Basic example - query #

This example uses a generic low level nostr request

import 'package:ndk/ndk.dart';

// Create an instance of Ndk
// It's recommended to keep this instance global as it holds critical application state
final ndk = Ndk(
  // Configure the Ndk instance using NdkConfig
  NdkConfig(
    // Use Bip340EventVerifier for event verification
    // in production RustEventVerifier() is recommended
    eventVerifier: Bip340EventVerifier(),
    // Use in-memory cache for storing Nostr data
    cache: MemCacheManager(),
  ),
);

// Create a query request using the Ndk instance
final response = ndk.requests.query(
  filters: [
    // Define a filter for the query
    Filter(
      // Query for fiatjaf npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6
      authors: [
        '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
      ],
      // Query for text note events (kind 1)
      kinds: [Nip01Event.kTextNodeKind],
      // Limit the results to 10 events
      limit: 10,
    ),
  ],
);
// Process the events as they arrive
await for (final event in response.stream) {
  print(event);
}
copied to clipboard
5
likes
140
points
264
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.22 - 2025.04.06

Nostr Development Kit - the most performant lib for all your nostr usecases

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bech32, bip340, collection, convert, crypto, cryptography, elliptic, equatable, hex, http, logger, meta, pointycastle, rxdart, web_socket_channel, web_socket_client

More

Packages that depend on ndk