Skip to content

Commit 92680e5

Browse files
committed
Expose Client::handle_notifications
1 parent 1aca803 commit 92680e5

File tree

12 files changed

+874
-286
lines changed

12 files changed

+874
-286
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* Expose `EventId` ([Yuki Kishimoto])
3535
* Expose `Alphabet`, `SingleLetterTag` and `Filter` ([Yuki Kishimoto])
3636
* Expose `Client::fetch_events` ([Yuki Kishimoto])
37+
* Expose `Client::handle_notifications` ([Yuki Kishimoto])
3738

3839
### Fixed
3940

lib/nostr_sdk.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export 'src/rust/api/protocol/signer.dart';
1515
export 'src/rust/api/relay/options.dart';
1616
export 'src/rust/api/client.dart';
1717
export 'src/rust/api/client/builder.dart';
18+
export 'src/rust/api/client/notification.dart';
1819
export 'src/rust/api/client/options.dart';
1920
export 'src/rust/api/client/output.dart';

lib/src/rust/api/client.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

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

87+
Stream<RelayPoolNotification> handleNotifications();
88+
8689
/// Check if signer is configured
8790
Future<bool> hasSigner();
8891

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file is automatically generated, so please do not edit it.
2+
// Generated by `flutter_rust_bridge`@ 2.0.0.
3+
4+
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
5+
6+
import '../../frb_generated.dart';
7+
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
8+
9+
// 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`
10+
11+
// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<RelayPoolNotification>>
12+
abstract class RelayPoolNotification implements RustOpaqueInterface {}

lib/src/rust/frb_generated.dart

Lines changed: 308 additions & 143 deletions
Large diffs are not rendered by default.

lib/src/rust/frb_generated.io.dart

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import 'api/client.dart';
77
import 'api/client/builder.dart';
8+
import 'api/client/notification.dart';
89
import 'api/client/options.dart';
910
import 'api/client/output.dart';
1011
import 'api/protocol/event.dart';
@@ -32,6 +33,10 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
3233
required super.portManager,
3334
});
3435

36+
CrossPlatformFinalizerArg
37+
get rust_arc_decrement_strong_count_RelayPoolNotificationPtr => wire
38+
._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotificationPtr;
39+
3540
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire
3641
._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr;
3742

@@ -86,6 +91,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
8691
@protected
8792
AnyhowException dco_decode_AnyhowException(dynamic raw);
8893

94+
@protected
95+
RelayPoolNotification
96+
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
97+
dynamic raw);
98+
8999
@protected
90100
Client
91101
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -240,6 +250,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
240250
@protected
241251
Map<String, String> dco_decode_Map_String_String(dynamic raw);
242252

253+
@protected
254+
RelayPoolNotification
255+
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
256+
dynamic raw);
257+
243258
@protected
244259
Client
245260
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -317,6 +332,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
317332
@protected
318333
Set<String> dco_decode_Set_String(dynamic raw);
319334

335+
@protected
336+
RustStreamSink<RelayPoolNotification>
337+
dco_decode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
338+
dynamic raw);
339+
320340
@protected
321341
String dco_decode_String(dynamic raw);
322342

@@ -424,6 +444,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
424444
@protected
425445
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
426446

447+
@protected
448+
RelayPoolNotification
449+
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
450+
SseDeserializer deserializer);
451+
427452
@protected
428453
Client
429454
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -579,6 +604,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
579604
Map<String, String> sse_decode_Map_String_String(
580605
SseDeserializer deserializer);
581606

607+
@protected
608+
RelayPoolNotification
609+
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
610+
SseDeserializer deserializer);
611+
582612
@protected
583613
Client
584614
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -656,6 +686,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
656686
@protected
657687
Set<String> sse_decode_Set_String(SseDeserializer deserializer);
658688

689+
@protected
690+
RustStreamSink<RelayPoolNotification>
691+
sse_decode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
692+
SseDeserializer deserializer);
693+
659694
@protected
660695
String sse_decode_String(SseDeserializer deserializer);
661696

@@ -767,6 +802,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
767802
void sse_encode_AnyhowException(
768803
AnyhowException self, SseSerializer serializer);
769804

805+
@protected
806+
void
807+
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
808+
RelayPoolNotification self, SseSerializer serializer);
809+
770810
@protected
771811
void
772812
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -924,6 +964,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
924964
void sse_encode_Map_String_String(
925965
Map<String, String> self, SseSerializer serializer);
926966

967+
@protected
968+
void
969+
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
970+
RelayPoolNotification self, SseSerializer serializer);
971+
927972
@protected
928973
void
929974
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -1002,6 +1047,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
10021047
@protected
10031048
void sse_encode_Set_String(Set<String> self, SseSerializer serializer);
10041049

1050+
@protected
1051+
void
1052+
sse_encode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
1053+
RustStreamSink<RelayPoolNotification> self, SseSerializer serializer);
1054+
10051055
@protected
10061056
void sse_encode_String(String self, SseSerializer serializer);
10071057

@@ -1130,6 +1180,38 @@ class NostrSdkWire implements BaseWire {
11301180
NostrSdkWire(ffi.DynamicLibrary dynamicLibrary)
11311181
: _lookup = dynamicLibrary.lookup;
11321182

1183+
void
1184+
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1185+
ffi.Pointer<ffi.Void> ptr,
1186+
) {
1187+
return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1188+
ptr,
1189+
);
1190+
}
1191+
1192+
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotificationPtr =
1193+
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
1194+
'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification');
1195+
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification =
1196+
_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotificationPtr
1197+
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
1198+
1199+
void
1200+
rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1201+
ffi.Pointer<ffi.Void> ptr,
1202+
) {
1203+
return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1204+
ptr,
1205+
);
1206+
}
1207+
1208+
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotificationPtr =
1209+
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
1210+
'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification');
1211+
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification =
1212+
_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotificationPtr
1213+
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
1214+
11331215
void
11341216
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
11351217
ffi.Pointer<ffi.Void> ptr,

lib/src/rust/frb_generated.web.dart

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import 'api/client.dart';
1010
import 'api/client/builder.dart';
11+
import 'api/client/notification.dart';
1112
import 'api/client/options.dart';
1213
import 'api/client/output.dart';
1314
import 'api/protocol/event.dart';
@@ -34,6 +35,10 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
3435
required super.portManager,
3536
});
3637

38+
CrossPlatformFinalizerArg
39+
get rust_arc_decrement_strong_count_RelayPoolNotificationPtr => wire
40+
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification;
41+
3742
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire
3843
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client;
3944

@@ -88,6 +93,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
8893
@protected
8994
AnyhowException dco_decode_AnyhowException(dynamic raw);
9095

96+
@protected
97+
RelayPoolNotification
98+
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
99+
dynamic raw);
100+
91101
@protected
92102
Client
93103
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -242,6 +252,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
242252
@protected
243253
Map<String, String> dco_decode_Map_String_String(dynamic raw);
244254

255+
@protected
256+
RelayPoolNotification
257+
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
258+
dynamic raw);
259+
245260
@protected
246261
Client
247262
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -319,6 +334,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
319334
@protected
320335
Set<String> dco_decode_Set_String(dynamic raw);
321336

337+
@protected
338+
RustStreamSink<RelayPoolNotification>
339+
dco_decode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
340+
dynamic raw);
341+
322342
@protected
323343
String dco_decode_String(dynamic raw);
324344

@@ -426,6 +446,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
426446
@protected
427447
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
428448

449+
@protected
450+
RelayPoolNotification
451+
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
452+
SseDeserializer deserializer);
453+
429454
@protected
430455
Client
431456
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -581,6 +606,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
581606
Map<String, String> sse_decode_Map_String_String(
582607
SseDeserializer deserializer);
583608

609+
@protected
610+
RelayPoolNotification
611+
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
612+
SseDeserializer deserializer);
613+
584614
@protected
585615
Client
586616
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -658,6 +688,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
658688
@protected
659689
Set<String> sse_decode_Set_String(SseDeserializer deserializer);
660690

691+
@protected
692+
RustStreamSink<RelayPoolNotification>
693+
sse_decode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
694+
SseDeserializer deserializer);
695+
661696
@protected
662697
String sse_decode_String(SseDeserializer deserializer);
663698

@@ -769,6 +804,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
769804
void sse_encode_AnyhowException(
770805
AnyhowException self, SseSerializer serializer);
771806

807+
@protected
808+
void
809+
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
810+
RelayPoolNotification self, SseSerializer serializer);
811+
772812
@protected
773813
void
774814
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -926,6 +966,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
926966
void sse_encode_Map_String_String(
927967
Map<String, String> self, SseSerializer serializer);
928968

969+
@protected
970+
void
971+
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
972+
RelayPoolNotification self, SseSerializer serializer);
973+
929974
@protected
930975
void
931976
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
@@ -1004,6 +1049,11 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
10041049
@protected
10051050
void sse_encode_Set_String(Set<String> self, SseSerializer serializer);
10061051

1052+
@protected
1053+
void
1054+
sse_encode_StreamSink_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification_Sse(
1055+
RustStreamSink<RelayPoolNotification> self, SseSerializer serializer);
1056+
10071057
@protected
10081058
void sse_encode_String(String self, SseSerializer serializer);
10091059

@@ -1123,6 +1173,18 @@ abstract class NostrSdkApiImplPlatform extends BaseApiImpl<NostrSdkWire> {
11231173
class NostrSdkWire implements BaseWire {
11241174
NostrSdkWire.fromExternalLibrary(ExternalLibrary lib);
11251175

1176+
void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1177+
int ptr) =>
1178+
wasmModule
1179+
.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1180+
ptr);
1181+
1182+
void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1183+
int ptr) =>
1184+
wasmModule
1185+
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1186+
ptr);
1187+
11261188
void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
11271189
int ptr) =>
11281190
wasmModule
@@ -1310,6 +1372,14 @@ external NostrSdkWasmModule get wasmModule;
13101372
@JS()
13111373
@anonymous
13121374
extension type NostrSdkWasmModule._(JSObject _) implements JSObject {
1375+
external void
1376+
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1377+
int ptr);
1378+
1379+
external void
1380+
rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRelayPoolNotification(
1381+
int ptr);
1382+
13131383
external void
13141384
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(
13151385
int ptr);

0 commit comments

Comments
 (0)