Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* Expose `EventBuilder::gift_wrap` ([Yuki Kishimoto])
* Expose `EventBuilder::private_msg` ([Yuki Kishimoto])
* Expose `UnwrappedGift` ([Yuki Kishimoto])
* Expose `Client::handle_notifications` ([Yuki Kishimoto])

### Fixed

Expand Down
1 change: 1 addition & 0 deletions lib/nostr_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export 'src/rust/api/protocol/signer.dart';
export 'src/rust/api/relay/options.dart';
export 'src/rust/api/client.dart';
export 'src/rust/api/client/builder.dart';
export 'src/rust/api/client/notification.dart';
export 'src/rust/api/client/options.dart';
export 'src/rust/api/client/output.dart';
3 changes: 3 additions & 0 deletions lib/src/rust/api/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import '../frb_generated.dart';
import 'client/builder.dart';
import 'client/notification.dart';
import 'client/output.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'protocol/event.dart';
Expand Down Expand Up @@ -83,6 +84,8 @@ abstract class Client implements RustOpaqueInterface {
/// Note: this method will remove the relay, also if it's in use for the gossip model or other service!
Future<void> forceRemoveRelay({required String url});

Stream<RelayPoolNotification> handleNotifications();

/// Check if signer is configured
Future<bool> hasSigner();

Expand Down
44 changes: 44 additions & 0 deletions lib/src/rust/api/client/notification.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0.

// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import '../../frb_generated.dart';
import '../protocol/event.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
part 'notification.freezed.dart';

// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `from`

@freezed
sealed class RelayPoolNotification with _$RelayPoolNotification {
const RelayPoolNotification._();

/// Received an [`Event`]. Does not include events sent by this client.
const factory RelayPoolNotification.event({
/// Relay url
required String relayUrl,

/// Subscription ID
required String subscriptionId,

/// Event
required Event event,
}) = RelayPoolNotification_Event;

/// Received a [`RelayMessage`]. Includes messages wrapping events that were sent by this client.
const factory RelayPoolNotification.message({
/// Relay url
required String relayUrl,

/// Relay Message
required String message,
}) = RelayPoolNotification_Message;

/// Shutdown
///
/// This notification variant is sent after [`Client::shutdown`] method is called and all connections have been closed.
const factory RelayPoolNotification.shutdown() =
RelayPoolNotification_Shutdown;
}
Loading
Loading