From 5ca19d279f55083c25d45b2a7ac77f49ff452bbe Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 15:02:54 +0700 Subject: [PATCH 01/14] feat: add comment kind --- .../nostr-sdk-ffi/src/protocol/event/kind.rs | 4 + .../lib/src/rust/api/client.dart | 30 +- .../lib/src/rust/api/protocol/event.dart | 85 +- .../lib/src/rust/api/protocol/key.dart | 43 +- .../src/rust/api/protocol/key/public_key.dart | 42 +- .../src/rust/api/protocol/key/secret_key.dart | 49 +- .../lib/src/rust/frb_generated.dart | 3507 ++++++++++------- .../lib/src/rust/frb_generated.io.dart | 789 ++-- .../lib/src/rust/frb_generated.web.dart | 638 ++- crates/nostr/src/event/kind.rs | 1 + 10 files changed, 3040 insertions(+), 2148 deletions(-) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/kind.rs b/bindings/nostr-sdk-ffi/src/protocol/event/kind.rs index 8e7588e4b..2d5d3884e 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/kind.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/kind.rs @@ -135,6 +135,8 @@ pub enum KindEnum { Repost, /// Generic Repost (NIP18) GenericRepost, + /// Comment (NIP22) + Comment, /// Reaction (NIP25) Reaction, /// Badge Award (NIP58) @@ -352,6 +354,7 @@ impl From for KindEnum { nostr::Kind::EventDeletion => Self::EventDeletion, nostr::Kind::Repost => Self::Repost, nostr::Kind::GenericRepost => Self::GenericRepost, + nostr::Kind::Comment => Self::Comment, nostr::Kind::Reaction => Self::Reaction, nostr::Kind::BadgeAward => Self::BadgeAward, nostr::Kind::ChannelCreation => Self::ChannelCreation, @@ -438,6 +441,7 @@ impl From for nostr::Kind { KindEnum::EventDeletion => Self::EventDeletion, KindEnum::Repost => Self::Repost, KindEnum::GenericRepost => Self::GenericRepost, + KindEnum::Comment => Self::Comment, KindEnum::Reaction => Self::Reaction, KindEnum::BadgeAward => Self::BadgeAward, KindEnum::ChannelCreation => Self::ChannelCreation, diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/client.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/client.dart index ada83b28c..edb9b6c8b 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/client.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/client.dart @@ -7,28 +7,14 @@ import '../frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'protocol/event.dart'; +// Rust type: RustOpaqueMoi> +abstract class Client implements RustOpaqueInterface { + Future addRelay({required String url}); - + Future connect(); - + static Client default_() => + RustLib.instance.api.crateApiClientClientDefault(); - - // Rust type: RustOpaqueMoi> - abstract class Client implements RustOpaqueInterface { - Future addRelay({required String url }); - - - Future connect(); - - -static Client default_()=>RustLib.instance.api.crateApiClientClientDefault(); - - - Future sendEvent({required Event event }); - - - - - } - - \ No newline at end of file + Future sendEvent({required Event event}); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/event.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/event.dart index 2127589dd..9de78ecaa 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/event.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/event.dart @@ -7,72 +7,47 @@ import '../../frb_generated.dart'; import 'key/public_key.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +// Rust type: RustOpaqueMoi> +abstract class Event implements RustOpaqueInterface { + Future asJson(); - + Future asPrettyJson(); - + /// Get event author (`pubkey` field) + Future author(); - - // Rust type: RustOpaqueMoi> - abstract class Event implements RustOpaqueInterface { - Future asJson(); + Future content(); + Future createdAt(); - Future asPrettyJson(); + static Event fromJson({required String json}) => + RustLib.instance.api.crateApiProtocolEventEventFromJson(json: json); + Future id(); -/// Get event author (`pubkey` field) - Future author(); + /// Returns `true` if the event has an expiration tag that is expired. + /// If an event has no expiration tag, then it will return `false`. + /// + /// + Future isExpired(); + /// Check if it's a protected event + /// + /// + Future isProtected(); - Future content(); + Future kind(); + Future signature(); - Future createdAt(); + Future>> tags(); + /// Verify both `EventId` and `Signature` + Future verify(); -static Event fromJson({required String json })=>RustLib.instance.api.crateApiProtocolEventEventFromJson(json: json); + /// Verify if the `EventId` it's composed correctly + Future verifyId(); - - Future id(); - - -/// Returns `true` if the event has an expiration tag that is expired. -/// If an event has no expiration tag, then it will return `false`. -/// -/// - Future isExpired(); - - -/// Check if it's a protected event -/// -/// - Future isProtected(); - - - Future kind(); - - - Future signature(); - - - Future>> tags(); - - -/// Verify both `EventId` and `Signature` - Future verify(); - - -/// Verify if the `EventId` it's composed correctly - Future verifyId(); - - -/// Verify only event `Signature` - Future verifySignature(); - - - - - } - - \ No newline at end of file + /// Verify only event `Signature` + Future verifySignature(); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key.dart index 31cd343a5..e8c059307 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key.dart @@ -8,35 +8,22 @@ import 'key/public_key.dart'; import 'key/secret_key.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +// Rust type: RustOpaqueMoi> +abstract class Keys implements RustOpaqueInterface { + /// Generate random keys + /// + /// This constructor use a random number generator that retrieves randomness from the operating system. + static Keys generate() => + RustLib.instance.api.crateApiProtocolKeyKeysGenerate(); - + factory Keys({required SecretKey secretKey}) => + RustLib.instance.api.crateApiProtocolKeyKeysNew(secretKey: secretKey); - + /// Parse secret key from `hex` or `bech32` + static Keys parse({required String secretKey}) => + RustLib.instance.api.crateApiProtocolKeyKeysParse(secretKey: secretKey); - - // Rust type: RustOpaqueMoi> - abstract class Keys implements RustOpaqueInterface { - /// Generate random keys -/// -/// This constructor use a random number generator that retrieves randomness from the operating system. -static Keys generate()=>RustLib.instance.api.crateApiProtocolKeyKeysGenerate(); + Future publicKey(); - -factory Keys({required SecretKey secretKey })=>RustLib.instance.api.crateApiProtocolKeyKeysNew(secretKey: secretKey); - - -/// Parse secret key from `hex` or `bech32` -static Keys parse({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeyKeysParse(secretKey: secretKey); - - - Future publicKey(); - - - Future secretKey(); - - - - - } - - \ No newline at end of file + Future secretKey(); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart index 2d521ffaf..957231d57 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart @@ -6,37 +6,25 @@ import '../../../frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.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` +// 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` // These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `to_bytes` +// Rust type: RustOpaqueMoi> +abstract class PublicKey implements RustOpaqueInterface { + static PublicKey fromHex({required String publicKey}) => RustLib.instance.api + .crateApiProtocolKeyPublicKeyPublicKeyFromHex(publicKey: publicKey); - - - - // Rust type: RustOpaqueMoi> - abstract class PublicKey implements RustOpaqueInterface { - static PublicKey fromHex({required String publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyFromHex(publicKey: publicKey); - - -static PublicKey fromSlice({required List publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyFromSlice(publicKey: publicKey); - - -/// Parse from `hex`, `bech32` or [NIP21](https://github.com/nostr-protocol/nips/blob/master/21.md) URI -static PublicKey parse({required String publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyParse(publicKey: publicKey); - - - Future toBech32(); - - - Future toHex(); - + static PublicKey fromSlice({required List publicKey}) => + RustLib.instance.api + .crateApiProtocolKeyPublicKeyPublicKeyFromSlice(publicKey: publicKey); - Future toNostrUri(); + /// Parse from `hex`, `bech32` or [NIP21](https://github.com/nostr-protocol/nips/blob/master/21.md) URI + static PublicKey parse({required String publicKey}) => RustLib.instance.api + .crateApiProtocolKeyPublicKeyPublicKeyParse(publicKey: publicKey); + Future toBech32(); + Future toHex(); - - } - - \ No newline at end of file + Future toNostrUri(); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart index 177293bc7..34e5c0f9a 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart @@ -6,40 +6,29 @@ import '../../../frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.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`, `from` +// 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`, `from` // These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `to_secret_bytes` +// Rust type: RustOpaqueMoi> +abstract class SecretKey implements RustOpaqueInterface { + static SecretKey fromHex({required String secretKey}) => RustLib.instance.api + .crateApiProtocolKeySecretKeySecretKeyFromHex(secretKey: secretKey); - - - - // Rust type: RustOpaqueMoi> - abstract class SecretKey implements RustOpaqueInterface { - static SecretKey fromHex({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyFromHex(secretKey: secretKey); - - -static SecretKey fromSlice({required List secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyFromSlice(secretKey: secretKey); - - -/// Generate random secret key -/// -/// This constructor use a random number generator that retrieves randomness from the operating system. -static SecretKey generate()=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyGenerate(); - - -/// Parse from `hex` or `bech32` -static SecretKey parse({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyParse(secretKey: secretKey); - - - Future toBech32(); - + static SecretKey fromSlice({required List secretKey}) => + RustLib.instance.api + .crateApiProtocolKeySecretKeySecretKeyFromSlice(secretKey: secretKey); - Future toSecretHex(); + /// Generate random secret key + /// + /// This constructor use a random number generator that retrieves randomness from the operating system. + static SecretKey generate() => + RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyGenerate(); + /// Parse from `hex` or `bech32` + static SecretKey parse({required String secretKey}) => RustLib.instance.api + .crateApiProtocolKeySecretKeySecretKeyParse(secretKey: secretKey); + Future toBech32(); - - } - - \ No newline at end of file + Future toSecretHex(); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart index 0277b0e66..f32297bf7 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart @@ -11,1570 +11,2077 @@ import 'api/protocol/key/secret_key.dart'; import 'dart:async'; import 'dart:convert'; import 'frb_generated.dart'; -import 'frb_generated.io.dart' if (dart.library.js_interop) 'frb_generated.web.dart'; +import 'frb_generated.io.dart' + if (dart.library.js_interop) 'frb_generated.web.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; +/// Main entrypoint of the Rust API +class RustLib extends BaseEntrypoint { + @internal + static final instance = RustLib._(); - /// Main entrypoint of the Rust API - class RustLib extends BaseEntrypoint { - @internal - static final instance = RustLib._(); + RustLib._(); - RustLib._(); + /// Initialize flutter_rust_bridge + static Future init({ + RustLibApi? api, + BaseHandler? handler, + ExternalLibrary? externalLibrary, + }) async { + await instance.initImpl( + api: api, + handler: handler, + externalLibrary: externalLibrary, + ); + } - /// Initialize flutter_rust_bridge - static Future init({ - RustLibApi? api, - BaseHandler? handler, - ExternalLibrary? externalLibrary, - }) async { - await instance.initImpl( - api: api, - handler: handler, - externalLibrary: externalLibrary, - ); - } + /// Initialize flutter_rust_bridge in mock mode. + /// No libraries for FFI are loaded. + static void initMock({ + required RustLibApi api, + }) { + instance.initMockImpl( + api: api, + ); + } - /// Initialize flutter_rust_bridge in mock mode. - /// No libraries for FFI are loaded. - static void initMock({ - required RustLibApi api, - }) { - instance.initMockImpl( - api: api, - ); - } + /// Dispose flutter_rust_bridge + /// + /// The call to this function is optional, since flutter_rust_bridge (and everything else) + /// is automatically disposed when the app stops. + static void dispose() => instance.disposeImpl(); - /// Dispose flutter_rust_bridge - /// - /// The call to this function is optional, since flutter_rust_bridge (and everything else) - /// is automatically disposed when the app stops. - static void dispose() => instance.disposeImpl(); + @override + ApiImplConstructor get apiImplConstructor => + RustLibApiImpl.new; - @override - ApiImplConstructor get apiImplConstructor => RustLibApiImpl.new; + @override + WireConstructor get wireConstructor => + RustLibWire.fromExternalLibrary; - @override - WireConstructor get wireConstructor => RustLibWire.fromExternalLibrary; + @override + Future executeRustInitializers() async { + await api.crateApiInitApp(); + } - @override - Future executeRustInitializers() async { - await api.crateApiInitApp(); + @override + ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig => + kDefaultExternalLibraryLoaderConfig; - } + @override + String get codegenVersion => '2.5.1'; - @override - ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig => kDefaultExternalLibraryLoaderConfig; + @override + int get rustContentHash => -967086899; - @override - String get codegenVersion => '2.5.1'; + static const kDefaultExternalLibraryLoaderConfig = + ExternalLibraryLoaderConfig( + stem: 'nostr_sdk_flutter', + ioDirectory: 'rust/target/release/', + webPrefix: 'pkg/', + ); +} - @override - int get rustContentHash => -967086899; +abstract class RustLibApi extends BaseApi { + Future crateApiInitApp(); - static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( - stem: 'nostr_sdk_flutter', - ioDirectory: 'rust/target/release/', - webPrefix: 'pkg/', - ); - } - + Future crateApiClientClientAddRelay( + {required Client that, required String url}); - abstract class RustLibApi extends BaseApi { - Future crateApiInitApp(); + Future crateApiClientClientConnect({required Client that}); -Future crateApiClientClientAddRelay({required Client that , required String url }); + Client crateApiClientClientDefault(); -Future crateApiClientClientConnect({required Client that }); + Future crateApiClientClientSendEvent( + {required Client that, required Event event}); -Client crateApiClientClientDefault(); + Future crateApiProtocolEventEventAsJson({required Event that}); -Future crateApiClientClientSendEvent({required Client that , required Event event }); + Future crateApiProtocolEventEventAsPrettyJson({required Event that}); -Future crateApiProtocolEventEventAsJson({required Event that }); + Future crateApiProtocolEventEventAuthor({required Event that}); -Future crateApiProtocolEventEventAsPrettyJson({required Event that }); + Future crateApiProtocolEventEventContent({required Event that}); -Future crateApiProtocolEventEventAuthor({required Event that }); + Future crateApiProtocolEventEventCreatedAt({required Event that}); -Future crateApiProtocolEventEventContent({required Event that }); + Event crateApiProtocolEventEventFromJson({required String json}); -Future crateApiProtocolEventEventCreatedAt({required Event that }); + Future crateApiProtocolEventEventId({required Event that}); -Event crateApiProtocolEventEventFromJson({required String json }); + Future crateApiProtocolEventEventIsExpired({required Event that}); -Future crateApiProtocolEventEventId({required Event that }); + Future crateApiProtocolEventEventIsProtected({required Event that}); -Future crateApiProtocolEventEventIsExpired({required Event that }); + Future crateApiProtocolEventEventKind({required Event that}); -Future crateApiProtocolEventEventIsProtected({required Event that }); + Future crateApiProtocolEventEventSignature({required Event that}); -Future crateApiProtocolEventEventKind({required Event that }); + Future>> crateApiProtocolEventEventTags( + {required Event that}); -Future crateApiProtocolEventEventSignature({required Event that }); + Future crateApiProtocolEventEventVerify({required Event that}); -Future>> crateApiProtocolEventEventTags({required Event that }); + Future crateApiProtocolEventEventVerifyId({required Event that}); -Future crateApiProtocolEventEventVerify({required Event that }); + Future crateApiProtocolEventEventVerifySignature({required Event that}); -Future crateApiProtocolEventEventVerifyId({required Event that }); + Keys crateApiProtocolKeyKeysGenerate(); -Future crateApiProtocolEventEventVerifySignature({required Event that }); + Keys crateApiProtocolKeyKeysNew({required SecretKey secretKey}); -Keys crateApiProtocolKeyKeysGenerate(); + Keys crateApiProtocolKeyKeysParse({required String secretKey}); -Keys crateApiProtocolKeyKeysNew({required SecretKey secretKey }); + Future crateApiProtocolKeyKeysPublicKey({required Keys that}); -Keys crateApiProtocolKeyKeysParse({required String secretKey }); + Future crateApiProtocolKeyKeysSecretKey({required Keys that}); -Future crateApiProtocolKeyKeysPublicKey({required Keys that }); + PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex( + {required String publicKey}); -Future crateApiProtocolKeyKeysSecretKey({required Keys that }); + PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice( + {required List publicKey}); -PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex({required String publicKey }); + PublicKey crateApiProtocolKeyPublicKeyPublicKeyParse( + {required String publicKey}); -PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice({required List publicKey }); + Future crateApiProtocolKeyPublicKeyPublicKeyToBech32( + {required PublicKey that}); -PublicKey crateApiProtocolKeyPublicKeyPublicKeyParse({required String publicKey }); + Future crateApiProtocolKeyPublicKeyPublicKeyToHex( + {required PublicKey that}); -Future crateApiProtocolKeyPublicKeyPublicKeyToBech32({required PublicKey that }); + Future crateApiProtocolKeyPublicKeyPublicKeyToNostrUri( + {required PublicKey that}); -Future crateApiProtocolKeyPublicKeyPublicKeyToHex({required PublicKey that }); + SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex( + {required String secretKey}); -Future crateApiProtocolKeyPublicKeyPublicKeyToNostrUri({required PublicKey that }); + SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice( + {required List secretKey}); -SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex({required String secretKey }); + SecretKey crateApiProtocolKeySecretKeySecretKeyGenerate(); -SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice({required List secretKey }); + SecretKey crateApiProtocolKeySecretKeySecretKeyParse( + {required String secretKey}); -SecretKey crateApiProtocolKeySecretKeySecretKeyGenerate(); + Future crateApiProtocolKeySecretKeySecretKeyToBech32( + {required SecretKey that}); -SecretKey crateApiProtocolKeySecretKeySecretKeyParse({required String secretKey }); + Future crateApiProtocolKeySecretKeySecretKeyToSecretHex( + {required SecretKey that}); -Future crateApiProtocolKeySecretKeySecretKeyToBech32({required SecretKey that }); + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Client; -Future crateApiProtocolKeySecretKeySecretKeyToSecretHex({required SecretKey that }); + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Client; -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Client; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr; -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Client; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Event; -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr; + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Event; -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Event; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr; -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Event; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Keys; -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr; + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Keys; -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Keys; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr; -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Keys; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_PublicKey; -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr; + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_PublicKey; -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_PublicKey; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr; -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_PublicKey; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_SecretKey; -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr; + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_SecretKey; -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_SecretKey; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_SecretKey; - -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr; - - - } - - - class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { - RustLibApiImpl({ - required super.handler, - required super.wire, - required super.generalizedFrbRustBinding, - required super.portManager, - }); - - @override Future crateApiInitApp() { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 1, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_unit, - decodeErrorData: null, - ) - , - constMeta: kCrateApiInitAppConstMeta, - argValues: [], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiInitAppConstMeta => const TaskConstMeta( - debugName: "init_app", - argNames: [], - ); - - -@override Future crateApiClientClientAddRelay({required Client that , required String url }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(that, serializer); -sse_encode_String(url, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 2, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_bool, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiClientClientAddRelayConstMeta, - argValues: [that, url], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiClientClientAddRelayConstMeta => const TaskConstMeta( - debugName: "Client_add_relay", - argNames: ["that", "url"], - ); - - -@override Future crateApiClientClientConnect({required Client that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 3, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_unit, - decodeErrorData: null, - ) - , - constMeta: kCrateApiClientClientConnectConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiClientClientConnectConstMeta => const TaskConstMeta( - debugName: "Client_connect", - argNames: ["that"], - ); - - -@override Client crateApiClientClientDefault() { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 4)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client, - decodeErrorData: null, - ) - , - constMeta: kCrateApiClientClientDefaultConstMeta, - argValues: [], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiClientClientDefaultConstMeta => const TaskConstMeta( - debugName: "Client_default", - argNames: [], - ); - - -@override Future crateApiClientClientSendEvent({required Client that , required Event event }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(that, serializer); -sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(event, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 5, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiClientClientSendEventConstMeta, - argValues: [that, event], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiClientClientSendEventConstMeta => const TaskConstMeta( - debugName: "Client_send_event", - argNames: ["that", "event"], - ); - - -@override Future crateApiProtocolEventEventAsJson({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 6, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolEventEventAsJsonConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventAsJsonConstMeta => const TaskConstMeta( - debugName: "Event_as_json", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventAsPrettyJson({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 7, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolEventEventAsPrettyJsonConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventAsPrettyJsonConstMeta => const TaskConstMeta( - debugName: "Event_as_pretty_json", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventAuthor({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 8, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventAuthorConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventAuthorConstMeta => const TaskConstMeta( - debugName: "Event_author", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventContent({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 9, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventContentConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventContentConstMeta => const TaskConstMeta( - debugName: "Event_content", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventCreatedAt({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 10, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_u_64, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventCreatedAtConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventCreatedAtConstMeta => const TaskConstMeta( - debugName: "Event_created_at", - argNames: ["that"], - ); - - -@override Event crateApiProtocolEventEventFromJson({required String json }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(json, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 11)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolEventEventFromJsonConstMeta, - argValues: [json], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventFromJsonConstMeta => const TaskConstMeta( - debugName: "Event_from_json", - argNames: ["json"], - ); - - -@override Future crateApiProtocolEventEventId({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 12, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventIdConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventIdConstMeta => const TaskConstMeta( - debugName: "Event_id", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventIsExpired({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_bool, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventIsExpiredConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventIsExpiredConstMeta => const TaskConstMeta( - debugName: "Event_is_expired", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventIsProtected({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 14, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_bool, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventIsProtectedConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventIsProtectedConstMeta => const TaskConstMeta( - debugName: "Event_is_protected", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventKind({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 15, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_u_16, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventKindConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventKindConstMeta => const TaskConstMeta( - debugName: "Event_kind", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventSignature({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 16, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventSignatureConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventSignatureConstMeta => const TaskConstMeta( - debugName: "Event_signature", - argNames: ["that"], - ); - - -@override Future>> crateApiProtocolEventEventTags({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 17, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_list_list_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventTagsConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventTagsConstMeta => const TaskConstMeta( - debugName: "Event_tags", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventVerify({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 18, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_unit, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolEventEventVerifyConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventVerifyConstMeta => const TaskConstMeta( - debugName: "Event_verify", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventVerifyId({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 19, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_bool, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventVerifyIdConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventVerifyIdConstMeta => const TaskConstMeta( - debugName: "Event_verify_id", - argNames: ["that"], - ); - - -@override Future crateApiProtocolEventEventVerifySignature({required Event that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 20, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_bool, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolEventEventVerifySignatureConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolEventEventVerifySignatureConstMeta => const TaskConstMeta( - debugName: "Event_verify_signature", - argNames: ["that"], - ); - - -@override Keys crateApiProtocolKeyKeysGenerate() { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 21)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeyKeysGenerateConstMeta, - argValues: [], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyKeysGenerateConstMeta => const TaskConstMeta( - debugName: "Keys_generate", - argNames: [], - ); - - -@override Keys crateApiProtocolKeyKeysNew({required SecretKey secretKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 22)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeyKeysNewConstMeta, - argValues: [secretKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyKeysNewConstMeta => const TaskConstMeta( - debugName: "Keys_new", - argNames: ["secretKey"], - ); - - -@override Keys crateApiProtocolKeyKeysParse({required String secretKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 23)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyKeysParseConstMeta, - argValues: [secretKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyKeysParseConstMeta => const TaskConstMeta( - debugName: "Keys_parse", - argNames: ["secretKey"], - ); - - -@override Future crateApiProtocolKeyKeysPublicKey({required Keys that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 24, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeyKeysPublicKeyConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyKeysPublicKeyConstMeta => const TaskConstMeta( - debugName: "Keys_public_key", - argNames: ["that"], - ); - - -@override Future crateApiProtocolKeyKeysSecretKey({required Keys that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 25, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeyKeysSecretKeyConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyKeysSecretKeyConstMeta => const TaskConstMeta( - debugName: "Keys_secret_key", - argNames: ["that"], - ); - - -@override PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex({required String publicKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta, - argValues: [publicKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta => const TaskConstMeta( - debugName: "PublicKey_from_hex", - argNames: ["publicKey"], - ); - - -@override PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice({required List publicKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_list_prim_u_8_loose(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyFromSliceConstMeta, - argValues: [publicKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyFromSliceConstMeta => const TaskConstMeta( - debugName: "PublicKey_from_slice", - argNames: ["publicKey"], - ); - - -@override PublicKey crateApiProtocolKeyPublicKeyPublicKeyParse({required String publicKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyParseConstMeta, - argValues: [publicKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyParseConstMeta => const TaskConstMeta( - debugName: "PublicKey_parse", - argNames: ["publicKey"], - ); - - -@override Future crateApiProtocolKeyPublicKeyPublicKeyToBech32({required PublicKey that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 29, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToBech32ConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToBech32ConstMeta => const TaskConstMeta( - debugName: "PublicKey_to_bech32", - argNames: ["that"], - ); - - -@override Future crateApiProtocolKeyPublicKeyPublicKeyToHex({required PublicKey that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 30, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToHexConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToHexConstMeta => const TaskConstMeta( - debugName: "PublicKey_to_hex", - argNames: ["that"], - ); - - -@override Future crateApiProtocolKeyPublicKeyPublicKeyToNostrUri({required PublicKey that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 31, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToNostrUriConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToNostrUriConstMeta => const TaskConstMeta( - debugName: "PublicKey_to_nostr_uri", - argNames: ["that"], - ); - - -@override SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex({required String secretKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta, - argValues: [secretKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta => const TaskConstMeta( - debugName: "SecretKey_from_hex", - argNames: ["secretKey"], - ); - - -@override SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice({required List secretKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_list_prim_u_8_loose(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyFromSliceConstMeta, - argValues: [secretKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyFromSliceConstMeta => const TaskConstMeta( - debugName: "SecretKey_from_slice", - argNames: ["secretKey"], - ); - - -@override SecretKey crateApiProtocolKeySecretKeySecretKeyGenerate() { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyGenerateConstMeta, - argValues: [], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyGenerateConstMeta => const TaskConstMeta( - debugName: "SecretKey_generate", - argNames: [], - ); - - -@override SecretKey crateApiProtocolKeySecretKeySecretKeyParse({required String secretKey }) { return handler.executeSync(SyncTask( - callFfi: () { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_String(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35)!; - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyParseConstMeta, - argValues: [secretKey], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyParseConstMeta => const TaskConstMeta( - debugName: "SecretKey_parse", - argNames: ["secretKey"], - ); - - -@override Future crateApiProtocolKeySecretKeySecretKeyToBech32({required SecretKey that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 36, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: sse_decode_AnyhowException, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyToBech32ConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyToBech32ConstMeta => const TaskConstMeta( - debugName: "SecretKey_to_bech32", - argNames: ["that"], - ); - - -@override Future crateApiProtocolKeySecretKeySecretKeyToSecretHex({required SecretKey that }) { return handler.executeNormal(NormalTask( - callFfi: (port_) { - - final serializer = SseSerializer(generalizedFrbRustBinding);sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(that, serializer); - pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 37, port: port_); - - }, - codec: - SseCodec( - decodeSuccessData: sse_decode_String, - decodeErrorData: null, - ) - , - constMeta: kCrateApiProtocolKeySecretKeySecretKeyToSecretHexConstMeta, - argValues: [that], - apiImpl: this, - )); } - - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyToSecretHexConstMeta => const TaskConstMeta( + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr; +} + +class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { + RustLibApiImpl({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + @override + Future crateApiInitApp() { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 1, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, + ), + constMeta: kCrateApiInitAppConstMeta, + argValues: [], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiInitAppConstMeta => const TaskConstMeta( + debugName: "init_app", + argNames: [], + ); + + @override + Future crateApiClientClientAddRelay( + {required Client that, required String url}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + that, serializer); + sse_encode_String(url, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 2, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_bool, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiClientClientAddRelayConstMeta, + argValues: [that, url], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiClientClientAddRelayConstMeta => + const TaskConstMeta( + debugName: "Client_add_relay", + argNames: ["that", "url"], + ); + + @override + Future crateApiClientClientConnect({required Client that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 3, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: null, + ), + constMeta: kCrateApiClientClientConnectConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiClientClientConnectConstMeta => + const TaskConstMeta( + debugName: "Client_connect", + argNames: ["that"], + ); + + @override + Client crateApiClientClientDefault() { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 4)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client, + decodeErrorData: null, + ), + constMeta: kCrateApiClientClientDefaultConstMeta, + argValues: [], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiClientClientDefaultConstMeta => + const TaskConstMeta( + debugName: "Client_default", + argNames: [], + ); + + @override + Future crateApiClientClientSendEvent( + {required Client that, required Event event}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + that, serializer); + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + event, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 5, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiClientClientSendEventConstMeta, + argValues: [that, event], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiClientClientSendEventConstMeta => + const TaskConstMeta( + debugName: "Client_send_event", + argNames: ["that", "event"], + ); + + @override + Future crateApiProtocolEventEventAsJson({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 6, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolEventEventAsJsonConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventAsJsonConstMeta => + const TaskConstMeta( + debugName: "Event_as_json", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventAsPrettyJson({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 7, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolEventEventAsPrettyJsonConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventAsPrettyJsonConstMeta => + const TaskConstMeta( + debugName: "Event_as_pretty_json", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventAuthor({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 8, port: port_); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventAuthorConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventAuthorConstMeta => + const TaskConstMeta( + debugName: "Event_author", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventContent({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 9, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventContentConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventContentConstMeta => + const TaskConstMeta( + debugName: "Event_content", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventCreatedAt({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 10, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_u_64, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventCreatedAtConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventCreatedAtConstMeta => + const TaskConstMeta( + debugName: "Event_created_at", + argNames: ["that"], + ); + + @override + Event crateApiProtocolEventEventFromJson({required String json}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(json, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 11)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolEventEventFromJsonConstMeta, + argValues: [json], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventFromJsonConstMeta => + const TaskConstMeta( + debugName: "Event_from_json", + argNames: ["json"], + ); + + @override + Future crateApiProtocolEventEventId({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 12, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventIdConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventIdConstMeta => + const TaskConstMeta( + debugName: "Event_id", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventIsExpired({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 13, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_bool, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventIsExpiredConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventIsExpiredConstMeta => + const TaskConstMeta( + debugName: "Event_is_expired", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventIsProtected({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 14, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_bool, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventIsProtectedConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventIsProtectedConstMeta => + const TaskConstMeta( + debugName: "Event_is_protected", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventKind({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 15, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_u_16, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventKindConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventKindConstMeta => + const TaskConstMeta( + debugName: "Event_kind", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventSignature({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 16, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventSignatureConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventSignatureConstMeta => + const TaskConstMeta( + debugName: "Event_signature", + argNames: ["that"], + ); + + @override + Future>> crateApiProtocolEventEventTags( + {required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 17, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_list_list_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventTagsConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventTagsConstMeta => + const TaskConstMeta( + debugName: "Event_tags", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventVerify({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 18, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_unit, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolEventEventVerifyConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventVerifyConstMeta => + const TaskConstMeta( + debugName: "Event_verify", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventVerifyId({required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 19, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_bool, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventVerifyIdConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventVerifyIdConstMeta => + const TaskConstMeta( + debugName: "Event_verify_id", + argNames: ["that"], + ); + + @override + Future crateApiProtocolEventEventVerifySignature( + {required Event that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 20, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_bool, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolEventEventVerifySignatureConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolEventEventVerifySignatureConstMeta => + const TaskConstMeta( + debugName: "Event_verify_signature", + argNames: ["that"], + ); + + @override + Keys crateApiProtocolKeyKeysGenerate() { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 21)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeyKeysGenerateConstMeta, + argValues: [], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyKeysGenerateConstMeta => + const TaskConstMeta( + debugName: "Keys_generate", + argNames: [], + ); + + @override + Keys crateApiProtocolKeyKeysNew({required SecretKey secretKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + secretKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 22)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeyKeysNewConstMeta, + argValues: [secretKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyKeysNewConstMeta => const TaskConstMeta( + debugName: "Keys_new", + argNames: ["secretKey"], + ); + + @override + Keys crateApiProtocolKeyKeysParse({required String secretKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(secretKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 23)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyKeysParseConstMeta, + argValues: [secretKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyKeysParseConstMeta => + const TaskConstMeta( + debugName: "Keys_parse", + argNames: ["secretKey"], + ); + + @override + Future crateApiProtocolKeyKeysPublicKey({required Keys that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 24, port: port_); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeyKeysPublicKeyConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyKeysPublicKeyConstMeta => + const TaskConstMeta( + debugName: "Keys_public_key", + argNames: ["that"], + ); + + @override + Future crateApiProtocolKeyKeysSecretKey({required Keys that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 25, port: port_); + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeyKeysSecretKeyConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyKeysSecretKeyConstMeta => + const TaskConstMeta( + debugName: "Keys_secret_key", + argNames: ["that"], + ); + + @override + PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex( + {required String publicKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(publicKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta, + argValues: [publicKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta => + const TaskConstMeta( + debugName: "PublicKey_from_hex", + argNames: ["publicKey"], + ); + + @override + PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice( + {required List publicKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_list_prim_u_8_loose(publicKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyFromSliceConstMeta, + argValues: [publicKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyFromSliceConstMeta => + const TaskConstMeta( + debugName: "PublicKey_from_slice", + argNames: ["publicKey"], + ); + + @override + PublicKey crateApiProtocolKeyPublicKeyPublicKeyParse( + {required String publicKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(publicKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyParseConstMeta, + argValues: [publicKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyParseConstMeta => + const TaskConstMeta( + debugName: "PublicKey_parse", + argNames: ["publicKey"], + ); + + @override + Future crateApiProtocolKeyPublicKeyPublicKeyToBech32( + {required PublicKey that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 29, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToBech32ConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToBech32ConstMeta => + const TaskConstMeta( + debugName: "PublicKey_to_bech32", + argNames: ["that"], + ); + + @override + Future crateApiProtocolKeyPublicKeyPublicKeyToHex( + {required PublicKey that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 30, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToHexConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToHexConstMeta => + const TaskConstMeta( + debugName: "PublicKey_to_hex", + argNames: ["that"], + ); + + @override + Future crateApiProtocolKeyPublicKeyPublicKeyToNostrUri( + {required PublicKey that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 31, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyToNostrUriConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyToNostrUriConstMeta => + const TaskConstMeta( + debugName: "PublicKey_to_nostr_uri", + argNames: ["that"], + ); + + @override + SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex( + {required String secretKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(secretKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta, + argValues: [secretKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta => + const TaskConstMeta( + debugName: "SecretKey_from_hex", + argNames: ["secretKey"], + ); + + @override + SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice( + {required List secretKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_list_prim_u_8_loose(secretKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyFromSliceConstMeta, + argValues: [secretKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyFromSliceConstMeta => + const TaskConstMeta( + debugName: "SecretKey_from_slice", + argNames: ["secretKey"], + ); + + @override + SecretKey crateApiProtocolKeySecretKeySecretKeyGenerate() { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyGenerateConstMeta, + argValues: [], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyGenerateConstMeta => + const TaskConstMeta( + debugName: "SecretKey_generate", + argNames: [], + ); + + @override + SecretKey crateApiProtocolKeySecretKeySecretKeyParse( + {required String secretKey}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_String(secretKey, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyParseConstMeta, + argValues: [secretKey], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyParseConstMeta => + const TaskConstMeta( + debugName: "SecretKey_parse", + argNames: ["secretKey"], + ); + + @override + Future crateApiProtocolKeySecretKeySecretKeyToBech32( + {required SecretKey that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 36, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: sse_decode_AnyhowException, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyToBech32ConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyToBech32ConstMeta => + const TaskConstMeta( + debugName: "SecretKey_to_bech32", + argNames: ["that"], + ); + + @override + Future crateApiProtocolKeySecretKeySecretKeyToSecretHex( + {required SecretKey that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + that, serializer); + pdeCallFfi(generalizedFrbRustBinding, serializer, + funcId: 37, port: port_); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_String, + decodeErrorData: null, + ), + constMeta: kCrateApiProtocolKeySecretKeySecretKeyToSecretHexConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta + get kCrateApiProtocolKeySecretKeySecretKeyToSecretHexConstMeta => + const TaskConstMeta( debugName: "SecretKey_to_secret_hex", argNames: ["that"], - ); - - -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Client => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Client => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; - -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Event => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Event => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; - -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Keys => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Keys => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; - -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_PublicKey => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_PublicKey => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; - -RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_SecretKey => wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; - -RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_SecretKey => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; - - - - @protected AnyhowException dco_decode_AnyhowException(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return AnyhowException(raw as String); } - -@protected Client dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return ClientImpl.frbInternalDcoDecode(raw as List); } - -@protected Event dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return EventImpl.frbInternalDcoDecode(raw as List); } - -@protected Keys dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return KeysImpl.frbInternalDcoDecode(raw as List); } - -@protected PublicKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return PublicKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected SecretKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return SecretKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected Client dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return ClientImpl.frbInternalDcoDecode(raw as List); } - -@protected Event dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return EventImpl.frbInternalDcoDecode(raw as List); } - -@protected Keys dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return KeysImpl.frbInternalDcoDecode(raw as List); } - -@protected PublicKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return PublicKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected SecretKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return SecretKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected Client dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return ClientImpl.frbInternalDcoDecode(raw as List); } - -@protected Event dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return EventImpl.frbInternalDcoDecode(raw as List); } - -@protected Keys dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return KeysImpl.frbInternalDcoDecode(raw as List); } - -@protected PublicKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return PublicKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected SecretKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return SecretKeyImpl.frbInternalDcoDecode(raw as List); } - -@protected String dco_decode_String(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as String; } - -@protected bool dco_decode_bool(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as bool; } - -@protected List dco_decode_list_String(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return (raw as List).map(dco_decode_String).toList(); } - -@protected List> dco_decode_list_list_String(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return (raw as List).map(dco_decode_list_String).toList(); } - -@protected List dco_decode_list_prim_u_8_loose(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as List; } - -@protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as Uint8List; } - -@protected int dco_decode_u_16(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as int; } - -@protected BigInt dco_decode_u_64(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return dcoDecodeU64(raw); } - -@protected int dco_decode_u_8(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return raw as int; } - -@protected void dco_decode_unit(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return; } - -@protected BigInt dco_decode_usize(dynamic raw){ // Codec=Dco (DartCObject based), see doc to use other codecs -return dcoDecodeU64(raw); } - -@protected AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -var inner = sse_decode_String(deserializer); - return AnyhowException(inner); } - -@protected Client sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return ClientImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Event sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return EventImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Keys sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return KeysImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected PublicKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return PublicKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected SecretKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return SecretKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Client sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return ClientImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Event sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return EventImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Keys sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return KeysImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected PublicKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return PublicKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected SecretKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return SecretKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Client sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return ClientImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Event sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return EventImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected Keys sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return KeysImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected PublicKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return PublicKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected SecretKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return SecretKeyImpl.frbInternalSseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } - -@protected String sse_decode_String(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -var inner = sse_decode_list_prim_u_8_strict(deserializer); - return utf8.decoder.convert(inner); } - -@protected bool sse_decode_bool(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getUint8() != 0; } - -@protected List sse_decode_list_String(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs - - var len_ = sse_decode_i_32(deserializer); - var ans_ = []; - for (var idx_ = 0; idx_ < len_; ++idx_) { ans_.add(sse_decode_String(deserializer)); } - return ans_; - } - -@protected List> sse_decode_list_list_String(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs - - var len_ = sse_decode_i_32(deserializer); - var ans_ = >[]; - for (var idx_ = 0; idx_ < len_; ++idx_) { ans_.add(sse_decode_list_String(deserializer)); } - return ans_; - } - -@protected List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -var len_ = sse_decode_i_32(deserializer); - return deserializer.buffer.getUint8List(len_); } - -@protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -var len_ = sse_decode_i_32(deserializer); - return deserializer.buffer.getUint8List(len_); } - -@protected int sse_decode_u_16(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getUint16(); } - -@protected BigInt sse_decode_u_64(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getBigUint64(); } - -@protected int sse_decode_u_8(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getUint8(); } - -@protected void sse_decode_unit(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs - } - -@protected BigInt sse_decode_usize(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getBigUint64(); } - -@protected int sse_decode_i_32(SseDeserializer deserializer){ // Codec=Sse (Serialization based), see doc to use other codecs -return deserializer.buffer.getInt32(); } - -@protected void sse_encode_AnyhowException(AnyhowException self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_String(self.message, serializer); } - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as ClientImpl).frbInternalSseEncode(move: true), serializer); } - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as EventImpl).frbInternalSseEncode(move: true), serializer); } - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as KeysImpl).frbInternalSseEncode(move: true), serializer); } - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as PublicKeyImpl).frbInternalSseEncode(move: true), serializer); } - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as SecretKeyImpl).frbInternalSseEncode(move: true), serializer); } - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as ClientImpl).frbInternalSseEncode(move: false), serializer); } - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as EventImpl).frbInternalSseEncode(move: false), serializer); } - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as KeysImpl).frbInternalSseEncode(move: false), serializer); } - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as PublicKeyImpl).frbInternalSseEncode(move: false), serializer); } - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as SecretKeyImpl).frbInternalSseEncode(move: false), serializer); } - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as ClientImpl).frbInternalSseEncode(move: null), serializer); } - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as EventImpl).frbInternalSseEncode(move: null), serializer); } - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as KeysImpl).frbInternalSseEncode(move: null), serializer); } - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as PublicKeyImpl).frbInternalSseEncode(move: null), serializer); } - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_usize((self as SecretKeyImpl).frbInternalSseEncode(move: null), serializer); } - -@protected void sse_encode_String(String self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); } - -@protected void sse_encode_bool(bool self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putUint8(self ? 1 : 0); } - -@protected void sse_encode_list_String(List self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_i_32(self.length, serializer); - for (final item in self) { sse_encode_String(item, serializer); } } - -@protected void sse_encode_list_list_String(List> self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_i_32(self.length, serializer); - for (final item in self) { sse_encode_list_String(item, serializer); } } - -@protected void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_i_32(self.length, serializer); - serializer.buffer.putUint8List(self is Uint8List ? self : Uint8List.fromList(self)); } - -@protected void sse_encode_list_prim_u_8_strict(Uint8List self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -sse_encode_i_32(self.length, serializer); - serializer.buffer.putUint8List(self); } - -@protected void sse_encode_u_16(int self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putUint16(self); } - -@protected void sse_encode_u_64(BigInt self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putBigUint64(self); } - -@protected void sse_encode_u_8(int self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putUint8(self); } - -@protected void sse_encode_unit(void self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs - } - -@protected void sse_encode_usize(BigInt self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putBigUint64(self); } - -@protected void sse_encode_i_32(int self, SseSerializer serializer){ // Codec=Sse (Serialization based), see doc to use other codecs -serializer.buffer.putInt32(self); } - } - - - @sealed class ClientImpl extends RustOpaque implements Client { - // Not to be used by end users - ClientImpl.frbInternalDcoDecode(List wire): - super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - ClientImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative): - super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_Client, - rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_Client, - rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_ClientPtr, - ); - - Future addRelay({required String url })=>RustLib.instance.api.crateApiClientClientAddRelay(that: this, url: url); - - - Future connect()=>RustLib.instance.api.crateApiClientClientConnect(that: this, ); - - - Future sendEvent({required Event event })=>RustLib.instance.api.crateApiClientClientSendEvent(that: this, event: event); - - - } - @sealed class EventImpl extends RustOpaque implements Event { - // Not to be used by end users - EventImpl.frbInternalDcoDecode(List wire): - super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - EventImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative): - super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_Event, - rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_Event, - rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_EventPtr, - ); - - Future asJson()=>RustLib.instance.api.crateApiProtocolEventEventAsJson(that: this, ); - - - Future asPrettyJson()=>RustLib.instance.api.crateApiProtocolEventEventAsPrettyJson(that: this, ); - - -/// Get event author (`pubkey` field) - Future author()=>RustLib.instance.api.crateApiProtocolEventEventAuthor(that: this, ); - - - Future content()=>RustLib.instance.api.crateApiProtocolEventEventContent(that: this, ); - - - Future createdAt()=>RustLib.instance.api.crateApiProtocolEventEventCreatedAt(that: this, ); - - - Future id()=>RustLib.instance.api.crateApiProtocolEventEventId(that: this, ); - - -/// Returns `true` if the event has an expiration tag that is expired. -/// If an event has no expiration tag, then it will return `false`. -/// -/// - Future isExpired()=>RustLib.instance.api.crateApiProtocolEventEventIsExpired(that: this, ); - - -/// Check if it's a protected event -/// -/// - Future isProtected()=>RustLib.instance.api.crateApiProtocolEventEventIsProtected(that: this, ); - - - Future kind()=>RustLib.instance.api.crateApiProtocolEventEventKind(that: this, ); - - - Future signature()=>RustLib.instance.api.crateApiProtocolEventEventSignature(that: this, ); - - - Future>> tags()=>RustLib.instance.api.crateApiProtocolEventEventTags(that: this, ); - - -/// Verify both `EventId` and `Signature` - Future verify()=>RustLib.instance.api.crateApiProtocolEventEventVerify(that: this, ); - - -/// Verify if the `EventId` it's composed correctly - Future verifyId()=>RustLib.instance.api.crateApiProtocolEventEventVerifyId(that: this, ); - - -/// Verify only event `Signature` - Future verifySignature()=>RustLib.instance.api.crateApiProtocolEventEventVerifySignature(that: this, ); - - - } - @sealed class KeysImpl extends RustOpaque implements Keys { - // Not to be used by end users - KeysImpl.frbInternalDcoDecode(List wire): - super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - KeysImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative): - super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_Keys, - rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_Keys, - rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_KeysPtr, - ); - - Future publicKey()=>RustLib.instance.api.crateApiProtocolKeyKeysPublicKey(that: this, ); - - - Future secretKey()=>RustLib.instance.api.crateApiProtocolKeyKeysSecretKey(that: this, ); - - - } - @sealed class PublicKeyImpl extends RustOpaque implements PublicKey { - // Not to be used by end users - PublicKeyImpl.frbInternalDcoDecode(List wire): - super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - PublicKeyImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative): - super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_PublicKey, - rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_PublicKey, - rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_PublicKeyPtr, - ); - - Future toBech32()=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToBech32(that: this, ); - - - Future toHex()=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToHex(that: this, ); - - - Future toNostrUri()=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToNostrUri(that: this, ); - - - } - @sealed class SecretKeyImpl extends RustOpaque implements SecretKey { - // Not to be used by end users - SecretKeyImpl.frbInternalDcoDecode(List wire): - super.frbInternalDcoDecode(wire, _kStaticData); - - // Not to be used by end users - SecretKeyImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative): - super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); - - static final _kStaticData = RustArcStaticData( - rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_SecretKey, - rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_SecretKey, - rustArcDecrementStrongCountPtr: RustLib.instance.api.rust_arc_decrement_strong_count_SecretKeyPtr, - ); - - Future toBech32()=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyToBech32(that: this, ); - - - Future toSecretHex()=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyToSecretHex(that: this, ); - - - } \ No newline at end of file + ); + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_Client => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_Client => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; + + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Event => + wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; + + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Event => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; + + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_Keys => + wire.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; + + RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_Keys => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_PublicKey => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_PublicKey => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; + + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_SecretKey => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_SecretKey => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return AnyhowException(raw as String); + } + + @protected + Client + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return ClientImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Event + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return EventImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Keys + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeysImpl.frbInternalDcoDecode(raw as List); + } + + @protected + PublicKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return PublicKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + SecretKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return SecretKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Client + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return ClientImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Event + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return EventImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Keys + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeysImpl.frbInternalDcoDecode(raw as List); + } + + @protected + PublicKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return PublicKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + SecretKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return SecretKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Client + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return ClientImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Event + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return EventImpl.frbInternalDcoDecode(raw as List); + } + + @protected + Keys + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return KeysImpl.frbInternalDcoDecode(raw as List); + } + + @protected + PublicKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return PublicKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + SecretKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return SecretKeyImpl.frbInternalDcoDecode(raw as List); + } + + @protected + String dco_decode_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as String; + } + + @protected + bool dco_decode_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as bool; + } + + @protected + List dco_decode_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_String).toList(); + } + + @protected + List> dco_decode_list_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_list_String).toList(); + } + + @protected + List dco_decode_list_prim_u_8_loose(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as List; + } + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as Uint8List; + } + + @protected + int dco_decode_u_16(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as int; + } + + @protected + BigInt dco_decode_u_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dcoDecodeU64(raw); + } + + @protected + int dco_decode_u_8(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as int; + } + + @protected + void dco_decode_unit(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return; + } + + @protected + BigInt dco_decode_usize(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dcoDecodeU64(raw); + } + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_String(deserializer); + return AnyhowException(inner); + } + + @protected + Client + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return ClientImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Event + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return EventImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Keys + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeysImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + PublicKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return PublicKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + SecretKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return SecretKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Client + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return ClientImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Event + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return EventImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Keys + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeysImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + PublicKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return PublicKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + SecretKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return SecretKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Client + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return ClientImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Event + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return EventImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + Keys + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return KeysImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + PublicKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return PublicKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + SecretKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return SecretKeyImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + + @protected + String sse_decode_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_list_prim_u_8_strict(deserializer); + return utf8.decoder.convert(inner); + } + + @protected + bool sse_decode_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint8() != 0; + } + + @protected + List sse_decode_list_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_String(deserializer)); + } + return ans_; + } + + @protected + List> sse_decode_list_list_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = >[]; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_list_String(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var len_ = sse_decode_i_32(deserializer); + return deserializer.buffer.getUint8List(len_); + } + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var len_ = sse_decode_i_32(deserializer); + return deserializer.buffer.getUint8List(len_); + } + + @protected + int sse_decode_u_16(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint16(); + } + + @protected + BigInt sse_decode_u_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getBigUint64(); + } + + @protected + int sse_decode_u_8(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getUint8(); + } + + @protected + void sse_decode_unit(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + } + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getBigUint64(); + } + + @protected + int sse_decode_i_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getInt32(); + } + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.message, serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as ClientImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as EventImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeysImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as PublicKeyImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as SecretKeyImpl).frbInternalSseEncode(move: true), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as ClientImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as EventImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeysImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as PublicKeyImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as SecretKeyImpl).frbInternalSseEncode(move: false), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as ClientImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as EventImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as KeysImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as PublicKeyImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as SecretKeyImpl).frbInternalSseEncode(move: null), serializer); + } + + @protected + void sse_encode_String(String self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); + } + + @protected + void sse_encode_bool(bool self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint8(self ? 1 : 0); + } + + @protected + void sse_encode_list_String(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_String(item, serializer); + } + } + + @protected + void sse_encode_list_list_String( + List> self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_list_String(item, serializer); + } + } + + @protected + void sse_encode_list_prim_u_8_loose( + List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + serializer.buffer + .putUint8List(self is Uint8List ? self : Uint8List.fromList(self)); + } + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + serializer.buffer.putUint8List(self); + } + + @protected + void sse_encode_u_16(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint16(self); + } + + @protected + void sse_encode_u_64(BigInt self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putBigUint64(self); + } + + @protected + void sse_encode_u_8(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putUint8(self); + } + + @protected + void sse_encode_unit(void self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + } + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putBigUint64(self); + } + + @protected + void sse_encode_i_32(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putInt32(self); + } +} + +@sealed +class ClientImpl extends RustOpaque implements Client { + // Not to be used by end users + ClientImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + ClientImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_Client, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_Client, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_ClientPtr, + ); + + Future addRelay({required String url}) => + RustLib.instance.api.crateApiClientClientAddRelay(that: this, url: url); + + Future connect() => RustLib.instance.api.crateApiClientClientConnect( + that: this, + ); + + Future sendEvent({required Event event}) => RustLib.instance.api + .crateApiClientClientSendEvent(that: this, event: event); +} + +@sealed +class EventImpl extends RustOpaque implements Event { + // Not to be used by end users + EventImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + EventImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_Event, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_Event, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_EventPtr, + ); + + Future asJson() => + RustLib.instance.api.crateApiProtocolEventEventAsJson( + that: this, + ); + + Future asPrettyJson() => + RustLib.instance.api.crateApiProtocolEventEventAsPrettyJson( + that: this, + ); + + /// Get event author (`pubkey` field) + Future author() => + RustLib.instance.api.crateApiProtocolEventEventAuthor( + that: this, + ); + + Future content() => + RustLib.instance.api.crateApiProtocolEventEventContent( + that: this, + ); + + Future createdAt() => + RustLib.instance.api.crateApiProtocolEventEventCreatedAt( + that: this, + ); + + Future id() => RustLib.instance.api.crateApiProtocolEventEventId( + that: this, + ); + + /// Returns `true` if the event has an expiration tag that is expired. + /// If an event has no expiration tag, then it will return `false`. + /// + /// + Future isExpired() => + RustLib.instance.api.crateApiProtocolEventEventIsExpired( + that: this, + ); + + /// Check if it's a protected event + /// + /// + Future isProtected() => + RustLib.instance.api.crateApiProtocolEventEventIsProtected( + that: this, + ); + + Future kind() => RustLib.instance.api.crateApiProtocolEventEventKind( + that: this, + ); + + Future signature() => + RustLib.instance.api.crateApiProtocolEventEventSignature( + that: this, + ); + + Future>> tags() => + RustLib.instance.api.crateApiProtocolEventEventTags( + that: this, + ); + + /// Verify both `EventId` and `Signature` + Future verify() => + RustLib.instance.api.crateApiProtocolEventEventVerify( + that: this, + ); + + /// Verify if the `EventId` it's composed correctly + Future verifyId() => + RustLib.instance.api.crateApiProtocolEventEventVerifyId( + that: this, + ); + + /// Verify only event `Signature` + Future verifySignature() => + RustLib.instance.api.crateApiProtocolEventEventVerifySignature( + that: this, + ); +} + +@sealed +class KeysImpl extends RustOpaque implements Keys { + // Not to be used by end users + KeysImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + KeysImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_Keys, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_Keys, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_KeysPtr, + ); + + Future publicKey() => + RustLib.instance.api.crateApiProtocolKeyKeysPublicKey( + that: this, + ); + + Future secretKey() => + RustLib.instance.api.crateApiProtocolKeyKeysSecretKey( + that: this, + ); +} + +@sealed +class PublicKeyImpl extends RustOpaque implements PublicKey { + // Not to be used by end users + PublicKeyImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + PublicKeyImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_PublicKey, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_PublicKey, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_PublicKeyPtr, + ); + + Future toBech32() => + RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToBech32( + that: this, + ); + + Future toHex() => + RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToHex( + that: this, + ); + + Future toNostrUri() => + RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyToNostrUri( + that: this, + ); +} + +@sealed +class SecretKeyImpl extends RustOpaque implements SecretKey { + // Not to be used by end users + SecretKeyImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + SecretKeyImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_SecretKey, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_SecretKey, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_SecretKeyPtr, + ); + + Future toBech32() => + RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyToBech32( + that: this, + ); + + Future toSecretHex() => + RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyToSecretHex( + that: this, + ); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.io.dart b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.io.dart index b15386bd8..aa2ab6c1e 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.io.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.io.dart @@ -14,324 +14,543 @@ import 'dart:ffi' as ffi; import 'frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart'; +abstract class RustLibApiImplPlatform extends BaseApiImpl { + RustLibApiImplPlatform({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr => + wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr => + wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw); + + @protected + Client + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + @protected + Event + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); + + @protected + Keys + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); + + @protected + PublicKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); + + @protected + SecretKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + Client + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + + @protected + Event + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); + + @protected + Keys + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); + + @protected + PublicKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); + + @protected + SecretKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + Client + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + + @protected + Event + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); + + @protected + Keys + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); + + @protected + PublicKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); + + @protected + SecretKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + String dco_decode_String(dynamic raw); + + @protected + bool dco_decode_bool(dynamic raw); + + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List> dco_decode_list_list_String(dynamic raw); + + @protected + List dco_decode_list_prim_u_8_loose(dynamic raw); + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + + @protected + int dco_decode_u_16(dynamic raw); + + @protected + BigInt dco_decode_u_64(dynamic raw); + + @protected + int dco_decode_u_8(dynamic raw); + + @protected + void dco_decode_unit(dynamic raw); + + @protected + BigInt dco_decode_usize(dynamic raw); + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); + + @protected + Client + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); + + @protected + Event + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); + + @protected + Keys + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); + @protected + PublicKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); - abstract class RustLibApiImplPlatform extends BaseApiImpl { - RustLibApiImplPlatform({ - required super.handler, - required super.wire, - required super.generalizedFrbRustBinding, - required super.portManager, - }); + @protected + SecretKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr; + @protected + Client + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr; + @protected + Event + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr; + @protected + Keys + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr; + @protected + PublicKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr => wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr; + @protected + SecretKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); + @protected + Client + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); + @protected + Event + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); - @protected AnyhowException dco_decode_AnyhowException(dynamic raw); + @protected + Keys + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); -@protected Client dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); + @protected + PublicKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); -@protected Event dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); + @protected + SecretKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); + + @protected + String sse_decode_String(SseDeserializer deserializer); + + @protected + bool sse_decode_bool(SseDeserializer deserializer); + + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List> sse_decode_list_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer); + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + + @protected + int sse_decode_u_16(SseDeserializer deserializer); + + @protected + BigInt sse_decode_u_64(SseDeserializer deserializer); + + @protected + int sse_decode_u_8(SseDeserializer deserializer); + + @protected + void sse_decode_unit(SseDeserializer deserializer); + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer); + + @protected + int sse_decode_i_32(SseDeserializer deserializer); + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected Keys dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected PublicKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected SecretKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected Client dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); -@protected Event dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected Keys dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected PublicKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected SecretKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected Client dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); -@protected Event dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected Keys dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected PublicKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected SecretKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected String dco_decode_String(dynamic raw); + @protected + void sse_encode_String(String self, SseSerializer serializer); -@protected bool dco_decode_bool(dynamic raw); + @protected + void sse_encode_bool(bool self, SseSerializer serializer); -@protected List dco_decode_list_String(dynamic raw); + @protected + void sse_encode_list_String(List self, SseSerializer serializer); -@protected List> dco_decode_list_list_String(dynamic raw); + @protected + void sse_encode_list_list_String( + List> self, SseSerializer serializer); -@protected List dco_decode_list_prim_u_8_loose(dynamic raw); + @protected + void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer); + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer); + + @protected + void sse_encode_u_16(int self, SseSerializer serializer); + + @protected + void sse_encode_u_64(BigInt self, SseSerializer serializer); + + @protected + void sse_encode_u_8(int self, SseSerializer serializer); -@protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); - -@protected int dco_decode_u_16(dynamic raw); - -@protected BigInt dco_decode_u_64(dynamic raw); - -@protected int dco_decode_u_8(dynamic raw); - -@protected void dco_decode_unit(dynamic raw); - -@protected BigInt dco_decode_usize(dynamic raw); - -@protected AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); - -@protected Client sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); - -@protected Event sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); - -@protected Keys sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); - -@protected PublicKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); - -@protected SecretKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); - -@protected Client sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); - -@protected Event sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); - -@protected Keys sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); - -@protected PublicKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); - -@protected SecretKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); - -@protected Client sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); - -@protected Event sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); - -@protected Keys sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); - -@protected PublicKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); - -@protected SecretKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); - -@protected String sse_decode_String(SseDeserializer deserializer); - -@protected bool sse_decode_bool(SseDeserializer deserializer); - -@protected List sse_decode_list_String(SseDeserializer deserializer); - -@protected List> sse_decode_list_list_String(SseDeserializer deserializer); - -@protected List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer); - -@protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); - -@protected int sse_decode_u_16(SseDeserializer deserializer); - -@protected BigInt sse_decode_u_64(SseDeserializer deserializer); - -@protected int sse_decode_u_8(SseDeserializer deserializer); - -@protected void sse_decode_unit(SseDeserializer deserializer); - -@protected BigInt sse_decode_usize(SseDeserializer deserializer); - -@protected int sse_decode_i_32(SseDeserializer deserializer); - -@protected void sse_encode_AnyhowException(AnyhowException self, SseSerializer serializer); - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); - -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); - -@protected void sse_encode_String(String self, SseSerializer serializer); - -@protected void sse_encode_bool(bool self, SseSerializer serializer); - -@protected void sse_encode_list_String(List self, SseSerializer serializer); - -@protected void sse_encode_list_list_String(List> self, SseSerializer serializer); - -@protected void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer); - -@protected void sse_encode_list_prim_u_8_strict(Uint8List self, SseSerializer serializer); - -@protected void sse_encode_u_16(int self, SseSerializer serializer); - -@protected void sse_encode_u_64(BigInt self, SseSerializer serializer); - -@protected void sse_encode_u_8(int self, SseSerializer serializer); - -@protected void sse_encode_unit(void self, SseSerializer serializer); - -@protected void sse_encode_usize(BigInt self, SseSerializer serializer); - -@protected void sse_encode_i_32(int self, SseSerializer serializer); - } - + @protected + void sse_encode_unit(void self, SseSerializer serializer); + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer); + @protected + void sse_encode_i_32(int self, SseSerializer serializer); +} // Section: wire_class - - class RustLibWire implements BaseWire { - - factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) => - RustLibWire(lib.ffiDynamicLibrary); - - /// Holds the symbol lookup function. - final ffi.Pointer Function(String symbolName) - _lookup; - - /// The symbols are looked up in [dynamicLibrary]. - RustLibWire(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; - - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client = _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr.asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client = _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr.asFunction)>(); - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event = _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr.asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event = _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr.asFunction)>(); - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys = _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr.asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys = _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr.asFunction)>(); - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey = _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr.asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey = _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr.asFunction)>(); - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( - ffi.Pointer ptr, - ) { - return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( - ptr, - ); - } - - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey'); - late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey = _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr.asFunction)>(); - - void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( - ffi.Pointer ptr, - ) { - return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( - ptr, - ); - } - - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr = _lookup)>>('frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey'); - late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey = _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr.asFunction)>(); - - } - \ No newline at end of file +class RustLibWire implements BaseWire { + factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) => + RustLibWire(lib.ffiDynamicLibrary); + + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + RustLibWire(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_ClientPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_EventPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_KeysPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKeyPtr + .asFunction)>(); + + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr = + _lookup)>>( + 'frbgen_nostr_sdk_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKeyPtr + .asFunction)>(); +} diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.web.dart b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.web.dart index 266248753..09b403333 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.web.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.web.dart @@ -3,7 +3,6 @@ // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field - // Static analysis wrongly picks the IO variant, thus ignore this // ignore_for_file: argument_type_not_assignable @@ -17,244 +16,481 @@ import 'dart:convert'; import 'frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart'; +abstract class RustLibApiImplPlatform extends BaseApiImpl { + RustLibApiImplPlatform({ + required super.handler, + required super.wire, + required super.generalizedFrbRustBinding, + required super.portManager, + }); + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr => + wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; + + @protected + AnyhowException dco_decode_AnyhowException(dynamic raw); + @protected + Client + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + @protected + Event + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); - abstract class RustLibApiImplPlatform extends BaseApiImpl { - RustLibApiImplPlatform({ - required super.handler, - required super.wire, - required super.generalizedFrbRustBinding, - required super.portManager, - }); - - CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_ClientPtr => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client; - -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_EventPtr => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event; - -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_KeysPtr => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys; - -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_PublicKeyPtr => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey; - -CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_SecretKeyPtr => wire.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey; - - - - @protected AnyhowException dco_decode_AnyhowException(dynamic raw); - -@protected Client dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); - -@protected Event dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); - -@protected Keys dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); - -@protected PublicKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); - -@protected SecretKey dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); - -@protected Client dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); - -@protected Event dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); - -@protected Keys dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); - -@protected PublicKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); - -@protected SecretKey dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); - -@protected Client dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(dynamic raw); - -@protected Event dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(dynamic raw); - -@protected Keys dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(dynamic raw); - -@protected PublicKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(dynamic raw); - -@protected SecretKey dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(dynamic raw); - -@protected String dco_decode_String(dynamic raw); - -@protected bool dco_decode_bool(dynamic raw); - -@protected List dco_decode_list_String(dynamic raw); - -@protected List> dco_decode_list_list_String(dynamic raw); - -@protected List dco_decode_list_prim_u_8_loose(dynamic raw); - -@protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); - -@protected int dco_decode_u_16(dynamic raw); - -@protected BigInt dco_decode_u_64(dynamic raw); - -@protected int dco_decode_u_8(dynamic raw); - -@protected void dco_decode_unit(dynamic raw); - -@protected BigInt dco_decode_usize(dynamic raw); - -@protected AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); - -@protected Client sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); - -@protected Event sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); - -@protected Keys sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); + @protected + Keys + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); -@protected PublicKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); + @protected + PublicKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); -@protected SecretKey sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); + @protected + SecretKey + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + Client + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + + @protected + Event + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); + + @protected + Keys + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); + + @protected + PublicKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); + + @protected + SecretKey + dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + Client + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + dynamic raw); + + @protected + Event + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + dynamic raw); + + @protected + Keys + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + dynamic raw); + + @protected + PublicKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + dynamic raw); + + @protected + SecretKey + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + dynamic raw); + + @protected + String dco_decode_String(dynamic raw); + + @protected + bool dco_decode_bool(dynamic raw); + + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List> dco_decode_list_list_String(dynamic raw); + + @protected + List dco_decode_list_prim_u_8_loose(dynamic raw); + + @protected + Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + + @protected + int dco_decode_u_16(dynamic raw); + + @protected + BigInt dco_decode_u_64(dynamic raw); + + @protected + int dco_decode_u_8(dynamic raw); + + @protected + void dco_decode_unit(dynamic raw); + + @protected + BigInt dco_decode_usize(dynamic raw); + + @protected + AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer); + + @protected + Client + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); + + @protected + Event + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); + + @protected + Keys + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); -@protected Client sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); + @protected + PublicKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); -@protected Event sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); + @protected + SecretKey + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); -@protected Keys sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); + @protected + Client + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); -@protected PublicKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); + @protected + Event + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); -@protected SecretKey sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); + @protected + Keys + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); -@protected Client sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(SseDeserializer deserializer); + @protected + PublicKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); -@protected Event sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(SseDeserializer deserializer); + @protected + SecretKey + sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); -@protected Keys sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(SseDeserializer deserializer); + @protected + Client + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + SseDeserializer deserializer); -@protected PublicKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(SseDeserializer deserializer); + @protected + Event + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + SseDeserializer deserializer); -@protected SecretKey sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SseDeserializer deserializer); + @protected + Keys + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + SseDeserializer deserializer); -@protected String sse_decode_String(SseDeserializer deserializer); + @protected + PublicKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + SseDeserializer deserializer); -@protected bool sse_decode_bool(SseDeserializer deserializer); + @protected + SecretKey + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SseDeserializer deserializer); + + @protected + String sse_decode_String(SseDeserializer deserializer); + + @protected + bool sse_decode_bool(SseDeserializer deserializer); + + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List> sse_decode_list_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer); + + @protected + Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + + @protected + int sse_decode_u_16(SseDeserializer deserializer); + + @protected + BigInt sse_decode_u_64(SseDeserializer deserializer); + + @protected + int sse_decode_u_8(SseDeserializer deserializer); + + @protected + void sse_decode_unit(SseDeserializer deserializer); + + @protected + BigInt sse_decode_usize(SseDeserializer deserializer); + + @protected + int sse_decode_i_32(SseDeserializer deserializer); + + @protected + void sse_encode_AnyhowException( + AnyhowException self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); + + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected List sse_decode_list_String(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected List> sse_decode_list_list_String(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected List sse_decode_list_prim_u_8_loose(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); -@protected int sse_decode_u_16(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected BigInt sse_decode_u_64(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected int sse_decode_u_8(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected void sse_decode_unit(SseDeserializer deserializer); + @protected + void + sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected BigInt sse_decode_usize(SseDeserializer deserializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + Client self, SseSerializer serializer); -@protected int sse_decode_i_32(SseDeserializer deserializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + Event self, SseSerializer serializer); -@protected void sse_encode_AnyhowException(AnyhowException self, SseSerializer serializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + Keys self, SseSerializer serializer); -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + PublicKey self, SseSerializer serializer); -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + SecretKey self, SseSerializer serializer); -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); + @protected + void sse_encode_String(String self, SseSerializer serializer); -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); + @protected + void sse_encode_bool(bool self, SseSerializer serializer); -@protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); + @protected + void sse_encode_list_String(List self, SseSerializer serializer); -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); + @protected + void sse_encode_list_list_String( + List> self, SseSerializer serializer); -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); + @protected + void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer); + + @protected + void sse_encode_list_prim_u_8_strict( + Uint8List self, SseSerializer serializer); + + @protected + void sse_encode_u_16(int self, SseSerializer serializer); + + @protected + void sse_encode_u_64(BigInt self, SseSerializer serializer); + + @protected + void sse_encode_u_8(int self, SseSerializer serializer); -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); - -@protected void sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(Client self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(Event self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(Keys self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(PublicKey self, SseSerializer serializer); - -@protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(SecretKey self, SseSerializer serializer); - -@protected void sse_encode_String(String self, SseSerializer serializer); - -@protected void sse_encode_bool(bool self, SseSerializer serializer); - -@protected void sse_encode_list_String(List self, SseSerializer serializer); - -@protected void sse_encode_list_list_String(List> self, SseSerializer serializer); - -@protected void sse_encode_list_prim_u_8_loose(List self, SseSerializer serializer); - -@protected void sse_encode_list_prim_u_8_strict(Uint8List self, SseSerializer serializer); - -@protected void sse_encode_u_16(int self, SseSerializer serializer); - -@protected void sse_encode_u_64(BigInt self, SseSerializer serializer); - -@protected void sse_encode_u_8(int self, SseSerializer serializer); - -@protected void sse_encode_unit(void self, SseSerializer serializer); - -@protected void sse_encode_usize(BigInt self, SseSerializer serializer); - -@protected void sse_encode_i_32(int self, SseSerializer serializer); - } - + @protected + void sse_encode_unit(void self, SseSerializer serializer); + + @protected + void sse_encode_usize(BigInt self, SseSerializer serializer); + @protected + void sse_encode_i_32(int self, SseSerializer serializer); +} // Section: wire_class class RustLibWire implements BaseWire { - RustLibWire.fromExternalLibrary(ExternalLibrary lib); - - void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(int ptr) => wasmModule.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(ptr); - -void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(int ptr) => wasmModule.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(ptr); - -void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(int ptr) => wasmModule.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(ptr); - -void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(int ptr) => wasmModule.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(ptr); - -void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(int ptr) => wasmModule.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(ptr); - -void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(int ptr) => wasmModule.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(ptr); - -void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(int ptr) => wasmModule.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(ptr); - -void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(int ptr) => wasmModule.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(ptr); - -void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(int ptr) => wasmModule.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(ptr); - -void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(int ptr) => wasmModule.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(ptr); - } - @JS('wasm_bindgen') external RustLibWasmModule get wasmModule; - - @JS() @anonymous extension type RustLibWasmModule._(JSObject _) implements JSObject { - external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(int ptr); - -external void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client(int ptr); - -external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(int ptr); - -external void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event(int ptr); - -external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(int ptr); - -external void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys(int ptr); - -external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(int ptr); - -external void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey(int ptr); - -external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(int ptr); - -external void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey(int ptr); - } - \ No newline at end of file + RustLibWire.fromExternalLibrary(ExternalLibrary lib); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + ptr); + + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + ptr); +} + +@JS('wasm_bindgen') +external RustLibWasmModule get wasmModule; + +@JS() +@anonymous +extension type RustLibWasmModule._(JSObject _) implements JSObject { + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Client( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Event( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Keys( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( + int ptr); + + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( + int ptr); +} diff --git a/crates/nostr/src/event/kind.rs b/crates/nostr/src/event/kind.rs index 18ff650ef..fcc1d00d3 100644 --- a/crates/nostr/src/event/kind.rs +++ b/crates/nostr/src/event/kind.rs @@ -100,6 +100,7 @@ kind_variants! { EventDeletion => 5, "Event Deletion (NIP09)", Repost => 6, "Repost (NIP18)", GenericRepost => 16, "Generic Repost (NIP18)", + Comment => 1111, "Comment (NIP22)", Reaction => 7, "Reaction (NIP25)", BadgeAward => 8, "Badge Award (NIP58)", ChannelCreation => 40, "Channel Creation (NIP28)", From 623915ac213bba503835b78705039ebc77677712 Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 15:34:28 +0700 Subject: [PATCH 02/14] feat: add comment to eventbuilder --- .../src/protocol/event/tag/standard.rs | 6 ++ crates/nostr/src/event/builder.rs | 86 +++++++++++++++++++ crates/nostr/src/event/tag/mod.rs | 10 +++ crates/nostr/src/event/tag/standard.rs | 13 ++- crates/nostr/src/nips/nip34.rs | 1 + 5 files changed, 113 insertions(+), 3 deletions(-) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs index 56c25278b..0cd6f9062 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs @@ -37,6 +37,8 @@ pub enum TagStandard { marker: Option, /// Should be the public key of the author of the referenced event public_key: Option>, + /// Whether the e tag is an uppercase E or not + uppercase: bool, }, /// Git clone (`clone` tag) /// @@ -279,11 +281,13 @@ impl From for TagStandard { relay_url, marker, public_key, + uppercase, } => Self::EventTag { event_id: Arc::new(event_id.into()), relay_url: relay_url.map(|u| u.to_string()), marker: marker.map(|m| m.into()), public_key: public_key.map(|p| Arc::new(p.into())), + uppercase, }, tag::TagStandard::GitClone(urls) => Self::GitClone { urls: urls.into_iter().map(|r| r.to_string()).collect(), @@ -475,11 +479,13 @@ impl TryFrom for tag::TagStandard { relay_url, marker, public_key, + uppercase, } => Ok(Self::Event { event_id: **event_id, relay_url: relay_url.map(UncheckedUrl::from), marker: marker.map(nip10::Marker::from), public_key: public_key.map(|p| **p), + uppercase, }), TagStandard::GitClone { urls } => { let mut parsed_urls: Vec = Vec::with_capacity(urls.len()); diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 631d833a8..05f124a2e 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -440,6 +440,7 @@ impl EventBuilder { relay_url: relay_url.clone(), marker: Some(Marker::Root), public_key: Some(root.pubkey), + uppercase: false, })); tags.push(Tag::public_key(root.pubkey)); @@ -464,6 +465,7 @@ impl EventBuilder { relay_url: relay_url.clone(), marker: Some(Marker::Root), public_key: Some(reply_to.pubkey), + uppercase: false, })); } } @@ -474,6 +476,7 @@ impl EventBuilder { relay_url, marker: Some(Marker::Reply), public_key: Some(reply_to.pubkey), + uppercase: false, })); tags.push(Tag::public_key(reply_to.pubkey)); @@ -496,6 +499,84 @@ impl EventBuilder { Self::new(Kind::TextNote, content, tags) } + /// Comment + /// + /// If no `root` is passed, the `rely_to` will be used for root `e` tag. + /// + /// + pub fn comment( + content: S, + reply_to: &Event, + root: Option<&Event>, + relay_url: Option, + ) -> Self + where + S: Into, + { + let mut tags: Vec = Vec::new(); + + // Add `E` and `K` tag of **root** event + if let Some(root) = root { + // ID and author + tags.push(Tag::from_standardized_without_cell(TagStandard::Event { + event_id: root.id, + relay_url: relay_url.clone(), + marker: Some(Marker::Root), + public_key: Some(root.pubkey), + uppercase: true, + })); + // Kind + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind( + root.kind, + ))); + + // Add others `p` tags + tags.extend( + root.tags + .iter() + .filter(|t| { + t.kind() + == TagKind::SingleLetter(SingleLetterTag { + character: Alphabet::P, + uppercase: false, + }) + }) + .cloned(), + ); + } + + // Add `e` tag of event author + tags.push(Tag::from_standardized_without_cell(TagStandard::Event { + event_id: reply_to.id, + relay_url, + marker: Some(Marker::Reply), + public_key: Some(reply_to.pubkey), + uppercase: false, + })); + // Add `k` tag of event kind + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind( + reply_to.kind, + ))); + + // Add others `p` tags of reply_to event + tags.extend( + reply_to + .tags + .iter() + .filter(|t| { + t.kind() + == TagKind::SingleLetter(SingleLetterTag { + character: Alphabet::P, + uppercase: false, + }) + }) + .cloned(), + ); + + // Compose event + Self::new(Kind::TextNote, content, tags) + } + /// Long-form text note (generally referred to as "articles" or "blog posts"). /// /// @@ -580,6 +661,7 @@ impl EventBuilder { marker: None, // NOTE: not add public key since it's already included as `p` tag public_key: None, + uppercase: false, }), Tag::public_key(event.pubkey), ], @@ -595,6 +677,7 @@ impl EventBuilder { marker: None, // NOTE: not add public key since it's already included as `p` tag public_key: None, + uppercase: false, }), Tag::public_key(event.pubkey), Tag::from_standardized_without_cell(TagStandard::Kind(event.kind)), @@ -691,6 +774,7 @@ impl EventBuilder { relay_url: relay_url.map(|u| u.into()), marker: None, public_key: None, + uppercase: false, })], ) } @@ -711,6 +795,7 @@ impl EventBuilder { relay_url: Some(relay_url.into()), marker: Some(Marker::Root), public_key: None, + uppercase: false, })], ) } @@ -1133,6 +1218,7 @@ impl EventBuilder { relay_url: relay_url.clone(), marker: None, public_key: None, + uppercase: false, }); tags.extend_from_slice(&[a_tag.clone(), badge_award_event_tag]); } diff --git a/crates/nostr/src/event/tag/mod.rs b/crates/nostr/src/event/tag/mod.rs index d7a30dd8e..36a7fba17 100644 --- a/crates/nostr/src/event/tag/mod.rs +++ b/crates/nostr/src/event/tag/mod.rs @@ -443,6 +443,7 @@ mod tests { relay_url: None, marker: Some(Marker::Reply), public_key: None, + uppercase: false, }; assert!(tag.is_reply()); @@ -454,6 +455,7 @@ mod tests { relay_url: None, marker: Some(Marker::Root), public_key: None, + uppercase: false, }; assert!(!tag.is_reply()); } @@ -628,6 +630,7 @@ mod tests { relay_url: Some(UncheckedUrl::empty()), marker: None, public_key: None, + uppercase: false, }) .to_vec() ); @@ -646,6 +649,7 @@ mod tests { relay_url: Some(UncheckedUrl::from("wss://relay.damus.io")), marker: None, public_key: None, + uppercase: false, }) .to_vec() ); @@ -794,6 +798,7 @@ mod tests { relay_url: None, marker: Some(Marker::Reply), public_key: None, + uppercase: false, }) .to_vec() ); @@ -819,6 +824,7 @@ mod tests { ) .unwrap() ), + uppercase: false, } .to_vec() ); @@ -1101,6 +1107,7 @@ mod tests { relay_url: Some(UncheckedUrl::empty()), marker: None, public_key: None, + uppercase: false, }) ); @@ -1119,6 +1126,7 @@ mod tests { relay_url: Some(UncheckedUrl::from("wss://relay.damus.io")), marker: None, public_key: None, + uppercase: false, }) ); @@ -1296,6 +1304,7 @@ mod tests { relay_url: None, marker: Some(Marker::Reply), public_key: None, + uppercase: false, }) ); @@ -1321,6 +1330,7 @@ mod tests { ) .unwrap() ), + uppercase: false, }) ); diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index a61c76385..ad205b3a7 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -44,6 +44,8 @@ pub enum TagStandard { marker: Option, /// Should be the public key of the author of the referenced event public_key: Option, + /// Whether the e tag is an uppercase E or not + uppercase: bool, }, /// Report event /// @@ -428,6 +430,7 @@ impl TagStandard { relay_url: None, marker: None, public_key: None, + uppercase: false, } } @@ -459,9 +462,11 @@ impl TagStandard { /// Get tag kind pub fn kind(&self) -> TagKind { match self { - Self::Event { .. } | Self::EventReport(..) => { - TagKind::SingleLetter(SingleLetterTag::lowercase(Alphabet::E)) - } + Self::Event { uppercase, .. } => TagKind::SingleLetter(SingleLetterTag { + character: Alphabet::E, + uppercase: *uppercase, + }), + Self::EventReport(..) => TagKind::SingleLetter(SingleLetterTag::lowercase(Alphabet::E)), Self::GitClone(..) => TagKind::Clone, Self::GitCommit(..) => TagKind::Commit, Self::GitEarliestUniqueCommitId(..) => { @@ -590,6 +595,7 @@ impl From for Vec { relay_url, marker, public_key, + .. } => { let mut tag = vec![tag_kind, event_id.to_hex()]; if let Some(relay_url) = relay_url { @@ -880,6 +886,7 @@ where Some(public_key) => Some(PublicKey::from_hex(public_key)?), None => None, }, + uppercase: false, }), }; } diff --git a/crates/nostr/src/nips/nip34.rs b/crates/nostr/src/nips/nip34.rs index f1934bdb7..9d13b1bf8 100644 --- a/crates/nostr/src/nips/nip34.rs +++ b/crates/nostr/src/nips/nip34.rs @@ -304,6 +304,7 @@ impl GitPatch { relay_url: None, marker: Some(Marker::Reply), public_key: None, + uppercase: false, })); } None => tags.push(Tag::hashtag("root")), From 14a5bd258dd2023adde9a54823615d8afb72c444 Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 15:40:58 +0700 Subject: [PATCH 03/14] feat: support uppercase k --- .../src/protocol/event/tag/standard.rs | 12 ++++++++-- crates/nostr/src/event/builder.rs | 24 ++++++++++++------- crates/nostr/src/event/tag/standard.rs | 16 ++++++------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs index 0cd6f9062..bb371c288 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs @@ -110,6 +110,8 @@ pub enum TagStandard { }, Kind { kind: KindEnum, + /// Whether the k tag is an uppercase K or not + uppercase: bool, }, RelayUrl { relay_url: String, @@ -355,7 +357,10 @@ impl From for TagStandard { tag::TagStandard::ExternalIdentity(identity) => Self::ExternalIdentity { identity: identity.into(), }, - tag::TagStandard::Kind(kind) => Self::Kind { kind: kind.into() }, + tag::TagStandard::Kind { kind, uppercase } => Self::Kind { + kind: kind.into(), + uppercase, + }, tag::TagStandard::Relay(url) => Self::RelayUrl { relay_url: url.to_string(), }, @@ -550,7 +555,10 @@ impl TryFrom for tag::TagStandard { coordinate: coordinate.as_ref().deref().clone(), relay_url: relay_url.map(UncheckedUrl::from), }), - TagStandard::Kind { kind } => Ok(Self::Kind(kind.into())), + TagStandard::Kind { kind, uppercase } => Ok(Self::Kind { + kind: kind.into(), + uppercase, + }), TagStandard::RelayUrl { relay_url } => Ok(Self::Relay(UncheckedUrl::from(relay_url))), TagStandard::POW { nonce, difficulty } => Ok(Self::POW { nonce: nonce.parse()?, diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 05f124a2e..3925f6de9 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -526,9 +526,10 @@ impl EventBuilder { uppercase: true, })); // Kind - tags.push(Tag::from_standardized_without_cell(TagStandard::Kind( - root.kind, - ))); + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { + kind: root.kind, + uppercase: true, + })); // Add others `p` tags tags.extend( @@ -554,9 +555,10 @@ impl EventBuilder { uppercase: false, })); // Add `k` tag of event kind - tags.push(Tag::from_standardized_without_cell(TagStandard::Kind( - reply_to.kind, - ))); + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { + kind: reply_to.kind, + uppercase: false, + })); // Add others `p` tags of reply_to event tags.extend( @@ -680,7 +682,10 @@ impl EventBuilder { uppercase: false, }), Tag::public_key(event.pubkey), - Tag::from_standardized_without_cell(TagStandard::Kind(event.kind)), + Tag::from_standardized_without_cell(TagStandard::Kind { + kind: event.kind, + uppercase: false, + }), ], ) } @@ -743,7 +748,10 @@ impl EventBuilder { tags.push(Tag::public_key(public_key)); if let Some(kind) = kind { - tags.push(Tag::from_standardized_without_cell(TagStandard::Kind(kind))); + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { + kind, + uppercase: false, + })); } Self::new(Kind::Reaction, reaction, tags) diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index ad205b3a7..5278361b3 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -103,7 +103,11 @@ pub enum TagStandard { coordinate: Coordinate, relay_url: Option, }, - Kind(Kind), + Kind { + kind: Kind, + /// Whether the k tag is an uppercase K or not + uppercase: bool, + }, Relay(UncheckedUrl), /// Proof of Work /// @@ -308,10 +312,6 @@ impl TagStandard { character: Alphabet::D, uppercase: false, }) => Ok(Self::Identifier(tag_1.to_string())), - TagKind::SingleLetter(SingleLetterTag { - character: Alphabet::K, - uppercase: false, - }) => Ok(Self::Kind(Kind::from_str(tag_1)?)), TagKind::SingleLetter(SingleLetterTag { character: Alphabet::M, uppercase: false, @@ -509,9 +509,9 @@ impl TagStandard { character: Alphabet::A, uppercase: false, }), - Self::Kind(..) => TagKind::SingleLetter(SingleLetterTag { + Self::Kind { uppercase, .. } => TagKind::SingleLetter(SingleLetterTag { character: Alphabet::K, - uppercase: false, + uppercase: *uppercase, }), Self::Relay(..) => TagKind::Relay, Self::POW { .. } => TagKind::Nonce, @@ -693,7 +693,7 @@ impl From for Vec { vec } TagStandard::ExternalIdentity(identity) => identity.into(), - TagStandard::Kind(kind) => vec![tag_kind, kind.to_string()], + TagStandard::Kind { kind, .. } => vec![tag_kind, kind.to_string()], TagStandard::Relay(url) => vec![tag_kind, url.to_string()], TagStandard::POW { nonce, difficulty } => { vec![tag_kind, nonce.to_string(), difficulty.to_string()] From 431b31bc39fbb286368f7c24006bd6a6872a454d Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 16:10:18 +0700 Subject: [PATCH 04/14] feat: add example --- crates/nostr-sdk/examples/comment.rs | 32 ++++++++++++++++++++++++++++ crates/nostr/src/event/builder.rs | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 crates/nostr-sdk/examples/comment.rs diff --git a/crates/nostr-sdk/examples/comment.rs b/crates/nostr-sdk/examples/comment.rs new file mode 100644 index 000000000..18aec0c7d --- /dev/null +++ b/crates/nostr-sdk/examples/comment.rs @@ -0,0 +1,32 @@ +// Copyright (c) 2022-2023 Yuki Kishimoto +// Copyright (c) 2023-2024 Rust Nostr Developers +// Distributed under the MIT software license + +use nostr_sdk::prelude::*; + +#[tokio::main] +async fn main() -> Result<()> { + tracing_subscriber::fmt::init(); + + let keys = Keys::generate(); + let client = Client::builder().signer(keys).build(); + + client.add_relay("wss://relay.damus.io/").await?; + client.add_relay("wss://relay.primal.net/").await?; + + client.connect().await; + + let event_id = + EventId::from_bech32("note1hrrgx2309my3wgeecx2tt6fl2nl8hcwl0myr3xvkcqpnq24pxg2q06armr")?; + let events = client + .fetch_events(vec![Filter::new().id(event_id)], None) + .await?; + + let reply_to = events.first().unwrap(); + let builder = EventBuilder::comment("This is a reply", reply_to, None, None); + + let output = client.send_event_builder(builder).await?; + println!("Output: {:?}", output); + + Ok(()) +} diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 3925f6de9..fdbbbc251 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -521,7 +521,7 @@ impl EventBuilder { tags.push(Tag::from_standardized_without_cell(TagStandard::Event { event_id: root.id, relay_url: relay_url.clone(), - marker: Some(Marker::Root), + marker: None, public_key: Some(root.pubkey), uppercase: true, })); @@ -550,7 +550,7 @@ impl EventBuilder { tags.push(Tag::from_standardized_without_cell(TagStandard::Event { event_id: reply_to.id, relay_url, - marker: Some(Marker::Reply), + marker: None, public_key: Some(reply_to.pubkey), uppercase: false, })); From 932256412e83d9452de506d5bd864f1ec702f560 Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 16:11:37 +0700 Subject: [PATCH 05/14] fix: eventbuilder for comment use wrong kind --- crates/nostr/src/event/builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index fdbbbc251..52b62c77a 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -576,7 +576,7 @@ impl EventBuilder { ); // Compose event - Self::new(Kind::TextNote, content, tags) + Self::new(Kind::Comment, content, tags) } /// Long-form text note (generally referred to as "articles" or "blog posts"). From fc61933c04d81f8c66d122bd8807932626ef51fe Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 16:23:32 +0700 Subject: [PATCH 06/14] fix: tag position --- crates/nostr/src/event/tag/standard.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index 5278361b3..9085a615f 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -604,9 +604,13 @@ impl From for Vec { if let Some(marker) = marker { tag.resize_with(3, String::new); tag.push(marker.to_string()); - } - if let Some(public_key) = public_key { - tag.resize_with(4, String::new); + + if let Some(public_key) = public_key { + tag.resize_with(4, String::new); + tag.push(public_key.to_string()); + } + } else if let Some(public_key) = public_key { + tag.resize_with(3, String::new); tag.push(public_key.to_string()); } tag From d9d875acd84a6ece97bf23fc8f2f8214cc428127 Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 16:36:19 +0700 Subject: [PATCH 07/14] fix: test --- crates/nostr/src/event/tag/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/nostr/src/event/tag/mod.rs b/crates/nostr/src/event/tag/mod.rs index 36a7fba17..cc743fb0e 100644 --- a/crates/nostr/src/event/tag/mod.rs +++ b/crates/nostr/src/event/tag/mod.rs @@ -808,7 +808,6 @@ mod tests { "e", "0000000000000000000000000000000000000000000000000000000000000001", "", - "", "0000000000000000000000000000000000000000000000000000000000000001", ], TagStandard::Event { From df5aa131cfe0537aee5cabb495e67e9bf6f19b10 Mon Sep 17 00:00:00 2001 From: reya Date: Fri, 8 Nov 2024 16:45:25 +0700 Subject: [PATCH 08/14] feat: add comment to client --- crates/nostr-sdk/examples/comment.rs | 9 +++++++-- crates/nostr-sdk/src/client/mod.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/crates/nostr-sdk/examples/comment.rs b/crates/nostr-sdk/examples/comment.rs index 18aec0c7d..0d3035b48 100644 --- a/crates/nostr-sdk/examples/comment.rs +++ b/crates/nostr-sdk/examples/comment.rs @@ -23,9 +23,14 @@ async fn main() -> Result<()> { .await?; let reply_to = events.first().unwrap(); - let builder = EventBuilder::comment("This is a reply", reply_to, None, None); - let output = client.send_event_builder(builder).await?; + // let builder = EventBuilder::comment("This is a reply", reply_to, None, None); + // let output = client.send_event_builder(builder).await?; + + let output = client + .comment("This is a reply", reply_to, None, None) + .await?; + println!("Output: {:?}", output); Ok(()) diff --git a/crates/nostr-sdk/src/client/mod.rs b/crates/nostr-sdk/src/client/mod.rs index 879d32098..b8781a3ea 100644 --- a/crates/nostr-sdk/src/client/mod.rs +++ b/crates/nostr-sdk/src/client/mod.rs @@ -1413,6 +1413,24 @@ impl Client { self.gift_wrap_to(urls, &receiver, rumor, None).await } + /// Comment + /// + /// + #[inline] + pub async fn comment( + &self, + content: S, + reply_to: &Event, + root: Option<&Event>, + relay_url: Option, + ) -> Result, Error> + where + S: Into, + { + let builder = EventBuilder::comment(content, reply_to, root, relay_url); + self.send_event_builder(builder).await + } + /// Repost #[inline] pub async fn repost( From 950be4ca6b9c3f83ba6ab8c7070c6077c6f5b01a Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 07:09:50 +0700 Subject: [PATCH 09/14] fix: test --- crates/nostr-sdk/src/client/mod.rs | 4 ++-- crates/nostr/src/event/builder.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/nostr-sdk/src/client/mod.rs b/crates/nostr-sdk/src/client/mod.rs index b8781a3ea..00f627422 100644 --- a/crates/nostr-sdk/src/client/mod.rs +++ b/crates/nostr-sdk/src/client/mod.rs @@ -1420,14 +1420,14 @@ impl Client { pub async fn comment( &self, content: S, - reply_to: &Event, + comment_to: &Event, root: Option<&Event>, relay_url: Option, ) -> Result, Error> where S: Into, { - let builder = EventBuilder::comment(content, reply_to, root, relay_url); + let builder = EventBuilder::comment(content, comment_to, root, relay_url); self.send_event_builder(builder).await } diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 52b62c77a..c8a4f545f 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -506,7 +506,7 @@ impl EventBuilder { /// pub fn comment( content: S, - reply_to: &Event, + comment_to: &Event, root: Option<&Event>, relay_url: Option, ) -> Self @@ -548,21 +548,21 @@ impl EventBuilder { // Add `e` tag of event author tags.push(Tag::from_standardized_without_cell(TagStandard::Event { - event_id: reply_to.id, + event_id: comment_to.id, relay_url, marker: None, - public_key: Some(reply_to.pubkey), + public_key: Some(comment_to.pubkey), uppercase: false, })); // Add `k` tag of event kind tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { - kind: reply_to.kind, + kind: comment_to.kind, uppercase: false, })); // Add others `p` tags of reply_to event tags.extend( - reply_to + comment_to .tags .iter() .filter(|t| { @@ -644,6 +644,7 @@ impl EventBuilder { relay_url, marker: None, public_key: None, + uppercase: false, })], )) } From bda50ea7ee551a75c1825208412bb8130c675cea Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 07:53:04 +0700 Subject: [PATCH 10/14] feat: support uppercase external identity --- .../src/protocol/event/tag/standard.rs | 18 ++- crates/nostr/README.md | 138 +++++++++--------- crates/nostr/src/event/tag/mod.rs | 13 +- crates/nostr/src/event/tag/standard.rs | 16 +- crates/nostr/src/nips/nip39.rs | 7 +- 5 files changed, 105 insertions(+), 87 deletions(-) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs index bb371c288..4ef81162b 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs @@ -103,6 +103,8 @@ pub enum TagStandard { }, ExternalIdentity { identity: Identity, + /// Whether the i tag is an uppercase I or not + uppercase: bool, }, CoordinateTag { coordinate: Arc, @@ -354,8 +356,12 @@ impl From for TagStandard { coordinate: Arc::new(coordinate.into()), relay_url: relay_url.map(|u| u.to_string()), }, - tag::TagStandard::ExternalIdentity(identity) => Self::ExternalIdentity { + tag::TagStandard::ExternalIdentity { + identity, + uppercase, + } => Self::ExternalIdentity { identity: identity.into(), + uppercase, }, tag::TagStandard::Kind { kind, uppercase } => Self::Kind { kind: kind.into(), @@ -545,9 +551,13 @@ impl TryFrom for tag::TagStandard { TagStandard::Hashtag { hashtag } => Ok(Self::Hashtag(hashtag)), TagStandard::Geohash { geohash } => Ok(Self::Geohash(geohash)), TagStandard::Identifier { identifier } => Ok(Self::Identifier(identifier)), - TagStandard::ExternalIdentity { identity } => { - Ok(Self::ExternalIdentity(identity.into())) - } + TagStandard::ExternalIdentity { + identity, + uppercase, + } => Ok(Self::ExternalIdentity { + identity: identity.into(), + uppercase, + }), TagStandard::CoordinateTag { coordinate, relay_url, diff --git a/crates/nostr/README.md b/crates/nostr/README.md index 9c208c07a..6644e91d8 100644 --- a/crates/nostr/README.md +++ b/crates/nostr/README.md @@ -11,10 +11,11 @@ Rust implementation of Nostr protocol. You may be interested in: -* [`nostr-sdk`](https://crates.io/crates/nostr-sdk) if you want to write a typical Nostr client or bot -* [`nostr-relay-pool`](https://crates.io/crates/nostr-relay-pool): Nostr Relay Pool -* [`nostr-connect`](https://crates.io/crates/nostr-connect): Nostr Connect (NIP46) -* [`nwc`](https://crates.io/crates/nwc): Nostr Wallet Connect (NWC) client + +- [`nostr-sdk`](https://crates.io/crates/nostr-sdk) if you want to write a typical Nostr client or bot +- [`nostr-relay-pool`](https://crates.io/crates/nostr-relay-pool): Nostr Relay Pool +- [`nostr-connect`](https://crates.io/crates/nostr-connect): Nostr Connect (NIP46) +- [`nwc`](https://crates.io/crates/nwc): Nostr Wallet Connect (NWC) client ## Getting started @@ -84,7 +85,7 @@ Check the example in the [embedded/](https://github.com/rust-nostr/nostr/tree/ma The following crate feature flags are available: | Feature | Default | Description | -|------------|:-------:|----------------------------------------------------------------------------------------------| +| ---------- | :-----: | -------------------------------------------------------------------------------------------- | | `std` | Yes | Enable `std` library | | `alloc` | No | Needed to use this library in `no_std` context | | `all-nips` | No | Enable all NIPs | @@ -104,70 +105,71 @@ The following crate feature flags are available: ## Supported NIPs | Supported | NIP | -|:---------:|-----------------------------------------------------------------------------------------------------------------| -| ✅ | [01 - Basic protocol flow description](https://github.com/nostr-protocol/nips/blob/master/01.md) | -| ✅ | [02 - Follow List](https://github.com/nostr-protocol/nips/blob/master/02.md) | -| ✅ | [03 - OpenTimestamps Attestations for Events](https://github.com/nostr-protocol/nips/blob/master/03.md) | -| ✅ | [04 - Encrypted Direct Message](https://github.com/nostr-protocol/nips/blob/master/04.md) | -| ✅ | [05 - Mapping Nostr keys to DNS-based internet ids](https://github.com/nostr-protocol/nips/blob/master/05.md) | -| ✅ | [06 - Basic key derivation from mnemonic seed phrase](https://github.com/nostr-protocol/nips/blob/master/06.md) | -| ✅ | [07 - `window.nostr` capability for web browsers](https://github.com/nostr-protocol/nips/blob/master/07.md) | -| ✅ | [09 - Event Deletion](https://github.com/nostr-protocol/nips/blob/master/09.md) | -| ✅ | [10 - Use of `e` and `p` tags in text events](https://github.com/nostr-protocol/nips/blob/master/10.md) | -| ✅ | [11 - Relay Information Document](https://github.com/nostr-protocol/nips/blob/master/11.md) | -| ✅ | [13 - Proof of Work](https://github.com/nostr-protocol/nips/blob/master/13.md) | -| ✅ | [14 - Subject tag in text events](https://github.com/nostr-protocol/nips/blob/master/14.md) | -| ✅ | [15 - Nostr Marketplace](https://github.com/nostr-protocol/nips/blob/master/15.md) | -| ✅ | [17 - Private Direct Messages](https://github.com/nostr-protocol/nips/blob/master/17.md) | -| ✅ | [18 - Reposts](https://github.com/nostr-protocol/nips/blob/master/18.md) | -| ✅ | [19 - bech32-encoded entities](https://github.com/nostr-protocol/nips/blob/master/19.md) | -| ✅ | [21 - URI scheme](https://github.com/nostr-protocol/nips/blob/master/21.md) | -| ✅ | [23 - Long-form Content](https://github.com/nostr-protocol/nips/blob/master/23.md) | -| ✅ | [24 - Extra metadata fields and tags](https://github.com/nostr-protocol/nips/blob/master/24.md) | -| ✅ | [25 - Reactions](https://github.com/nostr-protocol/nips/blob/master/25.md) | -| ✅ | [26 - Delegated Event Signing](https://github.com/nostr-protocol/nips/blob/master/26.md) | -| ❌ | [27 - Text Note References](https://github.com/nostr-protocol/nips/blob/master/27.md) | -| ✅ | [28 - Public Chat](https://github.com/nostr-protocol/nips/blob/master/28.md) | -| ❌ | [29 - Relay-based Groups](https://github.com/nostr-protocol/nips/blob/master/29.md) | -| ✅ | [30 - Custom Emoji](https://github.com/nostr-protocol/nips/blob/master/30.md) | -| ✅ | [31 - Dealing with Unknown Events](https://github.com/nostr-protocol/nips/blob/master/31.md) | -| ✅ | [32 - Labeling](https://github.com/nostr-protocol/nips/blob/master/32.md) | -| ✅ | [34 - `git` stuff](https://github.com/nostr-protocol/nips/blob/master/34.md) | -| ❌ | [35 - Torrents](https://github.com/nostr-protocol/nips/blob/master/35.md) | -| ✅ | [36 - Sensitive Content](https://github.com/nostr-protocol/nips/blob/master/36.md) | -| ❌ | [38 - User Statuses](https://github.com/nostr-protocol/nips/blob/master/38.md) | -| ✅ | [39 - External Identities in Profiles](https://github.com/nostr-protocol/nips/blob/master/39.md) | -| ✅ | [40 - Expiration Timestamp](https://github.com/nostr-protocol/nips/blob/master/40.md) | -| ✅ | [42 - Authentication of clients to relays](https://github.com/nostr-protocol/nips/blob/master/42.md) | -| ✅ | [44 - Encrypted Payloads (Versioned)](https://github.com/nostr-protocol/nips/blob/master/44.md) | -| ✅ | [45 - Event Counts](https://github.com/nostr-protocol/nips/blob/master/45.md) | -| ✅ | [46 - Nostr Connect](https://github.com/nostr-protocol/nips/blob/master/46.md) | -| ✅ | [47 - Wallet Connect](https://github.com/nostr-protocol/nips/blob/master/47.md) | -| ✅ | [48 - Proxy Tags](https://github.com/nostr-protocol/nips/blob/master/48.md) | -| ✅ | [49 - Private Key Encryption](https://github.com/nostr-protocol/nips/blob/master/49.md) | -| ✅ | [50 - Search Capability](https://github.com/nostr-protocol/nips/blob/master/50.md) | -| ✅ | [51 - Lists](https://github.com/nostr-protocol/nips/blob/master/51.md) | -| ❌ | [52 - Calendar Events](https://github.com/nostr-protocol/nips/blob/master/52.md) | -| ✅ | [53 - Live Activities](https://github.com/nostr-protocol/nips/blob/master/53.md) | -| ❌ | [54 - Wiki](https://github.com/nostr-protocol/nips/blob/master/54.md) | +| :-------: | --------------------------------------------------------------------------------------------------------------- | +| ✅ | [01 - Basic protocol flow description](https://github.com/nostr-protocol/nips/blob/master/01.md) | +| ✅ | [02 - Follow List](https://github.com/nostr-protocol/nips/blob/master/02.md) | +| ✅ | [03 - OpenTimestamps Attestations for Events](https://github.com/nostr-protocol/nips/blob/master/03.md) | +| ✅ | [04 - Encrypted Direct Message](https://github.com/nostr-protocol/nips/blob/master/04.md) | +| ✅ | [05 - Mapping Nostr keys to DNS-based internet ids](https://github.com/nostr-protocol/nips/blob/master/05.md) | +| ✅ | [06 - Basic key derivation from mnemonic seed phrase](https://github.com/nostr-protocol/nips/blob/master/06.md) | +| ✅ | [07 - `window.nostr` capability for web browsers](https://github.com/nostr-protocol/nips/blob/master/07.md) | +| ✅ | [09 - Event Deletion](https://github.com/nostr-protocol/nips/blob/master/09.md) | +| ✅ | [10 - Use of `e` and `p` tags in text events](https://github.com/nostr-protocol/nips/blob/master/10.md) | +| ✅ | [11 - Relay Information Document](https://github.com/nostr-protocol/nips/blob/master/11.md) | +| ✅ | [13 - Proof of Work](https://github.com/nostr-protocol/nips/blob/master/13.md) | +| ✅ | [14 - Subject tag in text events](https://github.com/nostr-protocol/nips/blob/master/14.md) | +| ✅ | [15 - Nostr Marketplace](https://github.com/nostr-protocol/nips/blob/master/15.md) | +| ✅ | [17 - Private Direct Messages](https://github.com/nostr-protocol/nips/blob/master/17.md) | +| ✅ | [18 - Reposts](https://github.com/nostr-protocol/nips/blob/master/18.md) | +| ✅ | [19 - bech32-encoded entities](https://github.com/nostr-protocol/nips/blob/master/19.md) | +| ✅ | [21 - URI scheme](https://github.com/nostr-protocol/nips/blob/master/21.md) | +| ✅ | [22 - Comment](https://github.com/nostr-protocol/nips/blob/master/22.md) | +| ✅ | [23 - Long-form Content](https://github.com/nostr-protocol/nips/blob/master/23.md) | +| ✅ | [24 - Extra metadata fields and tags](https://github.com/nostr-protocol/nips/blob/master/24.md) | +| ✅ | [25 - Reactions](https://github.com/nostr-protocol/nips/blob/master/25.md) | +| ✅ | [26 - Delegated Event Signing](https://github.com/nostr-protocol/nips/blob/master/26.md) | +| ❌ | [27 - Text Note References](https://github.com/nostr-protocol/nips/blob/master/27.md) | +| ✅ | [28 - Public Chat](https://github.com/nostr-protocol/nips/blob/master/28.md) | +| ❌ | [29 - Relay-based Groups](https://github.com/nostr-protocol/nips/blob/master/29.md) | +| ✅ | [30 - Custom Emoji](https://github.com/nostr-protocol/nips/blob/master/30.md) | +| ✅ | [31 - Dealing with Unknown Events](https://github.com/nostr-protocol/nips/blob/master/31.md) | +| ✅ | [32 - Labeling](https://github.com/nostr-protocol/nips/blob/master/32.md) | +| ✅ | [34 - `git` stuff](https://github.com/nostr-protocol/nips/blob/master/34.md) | +| ❌ | [35 - Torrents](https://github.com/nostr-protocol/nips/blob/master/35.md) | +| ✅ | [36 - Sensitive Content](https://github.com/nostr-protocol/nips/blob/master/36.md) | +| ❌ | [38 - User Statuses](https://github.com/nostr-protocol/nips/blob/master/38.md) | +| ✅ | [39 - External Identities in Profiles](https://github.com/nostr-protocol/nips/blob/master/39.md) | +| ✅ | [40 - Expiration Timestamp](https://github.com/nostr-protocol/nips/blob/master/40.md) | +| ✅ | [42 - Authentication of clients to relays](https://github.com/nostr-protocol/nips/blob/master/42.md) | +| ✅ | [44 - Encrypted Payloads (Versioned)](https://github.com/nostr-protocol/nips/blob/master/44.md) | +| ✅ | [45 - Event Counts](https://github.com/nostr-protocol/nips/blob/master/45.md) | +| ✅ | [46 - Nostr Connect](https://github.com/nostr-protocol/nips/blob/master/46.md) | +| ✅ | [47 - Wallet Connect](https://github.com/nostr-protocol/nips/blob/master/47.md) | +| ✅ | [48 - Proxy Tags](https://github.com/nostr-protocol/nips/blob/master/48.md) | +| ✅ | [49 - Private Key Encryption](https://github.com/nostr-protocol/nips/blob/master/49.md) | +| ✅ | [50 - Search Capability](https://github.com/nostr-protocol/nips/blob/master/50.md) | +| ✅ | [51 - Lists](https://github.com/nostr-protocol/nips/blob/master/51.md) | +| ❌ | [52 - Calendar Events](https://github.com/nostr-protocol/nips/blob/master/52.md) | +| ✅ | [53 - Live Activities](https://github.com/nostr-protocol/nips/blob/master/53.md) | +| ❌ | [54 - Wiki](https://github.com/nostr-protocol/nips/blob/master/54.md) | | - | [55 - Android Signer Application](https://github.com/nostr-protocol/nips/blob/master/55.md) | -| ✅ | [56 - Reporting](https://github.com/nostr-protocol/nips/blob/master/56.md) | -| ✅ | [57 - Lightning Zaps](https://github.com/nostr-protocol/nips/blob/master/57.md) | -| ✅ | [58 - Badges](https://github.com/nostr-protocol/nips/blob/master/58.md) | -| ✅ | [59 - Gift Wrap](https://github.com/nostr-protocol/nips/blob/master/59.md) | -| ✅ | [65 - Relay List Metadata](https://github.com/nostr-protocol/nips/blob/master/65.md) | -| ✅ | [70 - Protected Events](https://github.com/nostr-protocol/nips/blob/master/70.md) | -| ❌ | [71 - Video Events](https://github.com/nostr-protocol/nips/blob/master/71.md) | -| ❌ | [72 - Moderated Communities](https://github.com/nostr-protocol/nips/blob/master/72.md) | -| ❌ | [75 - Zap Goals](https://github.com/nostr-protocol/nips/blob/master/75.md) | -| ✅ | [78 - Arbitrary custom app data](https://github.com/nostr-protocol/nips/blob/master/78.md) | -| ❌ | [89 - Recommended Application Handlers](https://github.com/nostr-protocol/nips/blob/master/89.md) | -| ✅ | [90 - Data Vending Machine](https://github.com/nostr-protocol/nips/blob/master/90.md) | -| ❌ | [92 - Media Attachments](https://github.com/nostr-protocol/nips/blob/master/92.md) | -| ✅ | [94 - File Metadata](https://github.com/nostr-protocol/nips/blob/master/94.md) | -| ❌ | [96 - HTTP File Storage Integration](https://github.com/nostr-protocol/nips/blob/master/96.md) | -| ✅ | [98 - HTTP Auth](https://github.com/nostr-protocol/nips/blob/master/98.md) | -| ❌ | [99 - Classified Listings](https://github.com/nostr-protocol/nips/blob/master/99.md) | +| ✅ | [56 - Reporting](https://github.com/nostr-protocol/nips/blob/master/56.md) | +| ✅ | [57 - Lightning Zaps](https://github.com/nostr-protocol/nips/blob/master/57.md) | +| ✅ | [58 - Badges](https://github.com/nostr-protocol/nips/blob/master/58.md) | +| ✅ | [59 - Gift Wrap](https://github.com/nostr-protocol/nips/blob/master/59.md) | +| ✅ | [65 - Relay List Metadata](https://github.com/nostr-protocol/nips/blob/master/65.md) | +| ✅ | [70 - Protected Events](https://github.com/nostr-protocol/nips/blob/master/70.md) | +| ❌ | [71 - Video Events](https://github.com/nostr-protocol/nips/blob/master/71.md) | +| ❌ | [72 - Moderated Communities](https://github.com/nostr-protocol/nips/blob/master/72.md) | +| ❌ | [75 - Zap Goals](https://github.com/nostr-protocol/nips/blob/master/75.md) | +| ✅ | [78 - Arbitrary custom app data](https://github.com/nostr-protocol/nips/blob/master/78.md) | +| ❌ | [89 - Recommended Application Handlers](https://github.com/nostr-protocol/nips/blob/master/89.md) | +| ✅ | [90 - Data Vending Machine](https://github.com/nostr-protocol/nips/blob/master/90.md) | +| ❌ | [92 - Media Attachments](https://github.com/nostr-protocol/nips/blob/master/92.md) | +| ✅ | [94 - File Metadata](https://github.com/nostr-protocol/nips/blob/master/94.md) | +| ❌ | [96 - HTTP File Storage Integration](https://github.com/nostr-protocol/nips/blob/master/96.md) | +| ✅ | [98 - HTTP Auth](https://github.com/nostr-protocol/nips/blob/master/98.md) | +| ❌ | [99 - Classified Listings](https://github.com/nostr-protocol/nips/blob/master/99.md) | ## State diff --git a/crates/nostr/src/event/tag/mod.rs b/crates/nostr/src/event/tag/mod.rs index cc743fb0e..6cbfc960f 100644 --- a/crates/nostr/src/event/tag/mod.rs +++ b/crates/nostr/src/event/tag/mod.rs @@ -1066,11 +1066,14 @@ mod tests { assert_eq!( Tag::parse(&["i", "github:12345678", "abcdefghijklmnop"]).unwrap(), - Tag::from_standardized_without_cell(TagStandard::ExternalIdentity(Identity { - platform: ExternalIdentity::GitHub, - ident: "12345678".to_string(), - proof: "abcdefghijklmnop".to_string() - })) + Tag::from_standardized_without_cell(TagStandard::ExternalIdentity { + identity: Identity { + platform: ExternalIdentity::GitHub, + ident: "12345678".to_string(), + proof: "abcdefghijklmnop".to_string() + }, + uppercase: false + }) ); assert_eq!( diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index 9085a615f..49505161b 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -98,7 +98,11 @@ pub enum TagStandard { Hashtag(String), Geohash(String), Identifier(String), - ExternalIdentity(Identity), + ExternalIdentity { + identity: Identity, + /// Whether the i tag is an uppercase I or not + uppercase: bool, + }, Coordinate { coordinate: Coordinate, relay_url: Option, @@ -378,10 +382,6 @@ impl TagStandard { let tag_2: &str = tag[2].as_ref(); return match tag_kind { - TagKind::SingleLetter(SingleLetterTag { - character: Alphabet::I, - uppercase: false, - }) => Ok(Self::ExternalIdentity(Identity::new(tag_1, tag_2)?)), TagKind::Nonce => Ok(Self::POW { nonce: tag_1.parse()?, difficulty: tag_2.parse()?, @@ -501,9 +501,9 @@ impl TagStandard { character: Alphabet::D, uppercase: false, }), - Self::ExternalIdentity(..) => TagKind::SingleLetter(SingleLetterTag { + Self::ExternalIdentity { uppercase, .. } => TagKind::SingleLetter(SingleLetterTag { character: Alphabet::I, - uppercase: false, + uppercase: *uppercase, }), Self::Coordinate { .. } => TagKind::SingleLetter(SingleLetterTag { character: Alphabet::A, @@ -696,7 +696,7 @@ impl From for Vec { } vec } - TagStandard::ExternalIdentity(identity) => identity.into(), + TagStandard::ExternalIdentity { identity, .. } => identity.into(), TagStandard::Kind { kind, .. } => vec![tag_kind, kind.to_string()], TagStandard::Relay(url) => vec![tag_kind, url.to_string()], TagStandard::POW { nonce, difficulty } => { diff --git a/crates/nostr/src/nips/nip39.rs b/crates/nostr/src/nips/nip39.rs index 07da92282..dae89a419 100644 --- a/crates/nostr/src/nips/nip39.rs +++ b/crates/nostr/src/nips/nip39.rs @@ -107,7 +107,7 @@ impl TryFrom for Identity { fn try_from(value: TagStandard) -> Result { match value { - TagStandard::ExternalIdentity(iden) => Ok(iden), + TagStandard::ExternalIdentity { identity, .. } => Ok(identity), _ => Err(Error::InvalidIdentity), } } @@ -115,7 +115,10 @@ impl TryFrom for Identity { impl From for TagStandard { fn from(value: Identity) -> Self { - Self::ExternalIdentity(value) + Self::ExternalIdentity { + identity: value, + uppercase: false, + } } } From 984f7f2634081345e3fc63b8e92c107f8f55fec8 Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 08:22:28 +0700 Subject: [PATCH 11/14] feat: support uppercase coordinate --- bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs | 6 ++++++ crates/nostr-sdk/examples/comment.rs | 4 ++-- crates/nostr/src/event/builder.rs | 2 ++ crates/nostr/src/event/tag/mod.rs | 7 +++++-- crates/nostr/src/event/tag/standard.rs | 8 ++++++-- crates/nostr/src/nips/nip01.rs | 1 + 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs index 4ef81162b..79fa27a0d 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs @@ -109,6 +109,8 @@ pub enum TagStandard { CoordinateTag { coordinate: Arc, relay_url: Option, + /// Whether the a tag is an uppercase A or not + uppercase: bool, }, Kind { kind: KindEnum, @@ -352,9 +354,11 @@ impl From for TagStandard { tag::TagStandard::Coordinate { coordinate, relay_url, + uppercase, } => Self::CoordinateTag { coordinate: Arc::new(coordinate.into()), relay_url: relay_url.map(|u| u.to_string()), + uppercase, }, tag::TagStandard::ExternalIdentity { identity, @@ -561,9 +565,11 @@ impl TryFrom for tag::TagStandard { TagStandard::CoordinateTag { coordinate, relay_url, + uppercase, } => Ok(Self::Coordinate { coordinate: coordinate.as_ref().deref().clone(), relay_url: relay_url.map(UncheckedUrl::from), + uppercase, }), TagStandard::Kind { kind, uppercase } => Ok(Self::Kind { kind: kind.into(), diff --git a/crates/nostr-sdk/examples/comment.rs b/crates/nostr-sdk/examples/comment.rs index 0d3035b48..c99413bf4 100644 --- a/crates/nostr-sdk/examples/comment.rs +++ b/crates/nostr-sdk/examples/comment.rs @@ -22,13 +22,13 @@ async fn main() -> Result<()> { .fetch_events(vec![Filter::new().id(event_id)], None) .await?; - let reply_to = events.first().unwrap(); + let comment_to = events.first().unwrap(); // let builder = EventBuilder::comment("This is a reply", reply_to, None, None); // let output = client.send_event_builder(builder).await?; let output = client - .comment("This is a reply", reply_to, None, None) + .comment("This is a reply", comment_to, None, None) .await?; println!("Output: {:?}", output); diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index c8a4f545f..b04ede778 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -912,6 +912,7 @@ impl EventBuilder { coordinate: Coordinate::new(Kind::LiveEvent, live_event_host) .identifier(live_event_id), relay_url: relay_url.map(|u| u.into()), + uppercase: false, }, )], ) @@ -1147,6 +1148,7 @@ impl EventBuilder { coordinate: Coordinate::new(Kind::BadgeDefinition, badge_definition.pubkey) .identifier(badge_id), relay_url: None, + uppercase: false, }, )); diff --git a/crates/nostr/src/event/tag/mod.rs b/crates/nostr/src/event/tag/mod.rs index 6cbfc960f..934d6c15c 100644 --- a/crates/nostr/src/event/tag/mod.rs +++ b/crates/nostr/src/event/tag/mod.rs @@ -207,6 +207,7 @@ impl Tag { Self::from_standardized_without_cell(TagStandard::Coordinate { coordinate, relay_url: None, + uppercase: false, }) } @@ -721,7 +722,8 @@ mod tests { .unwrap() ) .identifier("ipsum"), - relay_url: Some(UncheckedUrl::from_str("wss://relay.nostr.org").unwrap()) + relay_url: Some(UncheckedUrl::from_str("wss://relay.nostr.org").unwrap()), + uppercase: false }) .to_vec() ); @@ -1214,7 +1216,8 @@ mod tests { .unwrap() ) .identifier("ipsum"), - relay_url: Some(UncheckedUrl::from_str("wss://relay.nostr.org").unwrap()) + relay_url: Some(UncheckedUrl::from_str("wss://relay.nostr.org").unwrap()), + uppercase: false }) ); diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index 49505161b..60abdb776 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -106,6 +106,8 @@ pub enum TagStandard { Coordinate { coordinate: Coordinate, relay_url: Option, + /// Whether the a tag is an uppercase A or not + uppercase: bool, }, Kind { kind: Kind, @@ -505,9 +507,9 @@ impl TagStandard { character: Alphabet::I, uppercase: *uppercase, }), - Self::Coordinate { .. } => TagKind::SingleLetter(SingleLetterTag { + Self::Coordinate { uppercase, .. } => TagKind::SingleLetter(SingleLetterTag { character: Alphabet::A, - uppercase: false, + uppercase: *uppercase, }), Self::Kind { uppercase, .. } => TagKind::SingleLetter(SingleLetterTag { character: Alphabet::K, @@ -689,6 +691,7 @@ impl From for Vec { TagStandard::Coordinate { coordinate, relay_url, + .. } => { let mut vec = vec![tag_kind, coordinate.to_string()]; if let Some(relay) = relay_url { @@ -861,6 +864,7 @@ where Ok(TagStandard::Coordinate { coordinate, relay_url, + uppercase: false, }) } else { Err(Error::UnknownStardardizedTag) diff --git a/crates/nostr/src/nips/nip01.rs b/crates/nostr/src/nips/nip01.rs index 0a3a856d2..46656c23a 100644 --- a/crates/nostr/src/nips/nip01.rs +++ b/crates/nostr/src/nips/nip01.rs @@ -160,6 +160,7 @@ impl From for Tag { Self::from_standardized(TagStandard::Coordinate { relay_url: coordinate.relays.first().cloned().map(UncheckedUrl::from), coordinate, + uppercase: false, }) } } From 840324666bc64f3eefbe6d92568abe24ccaae14f Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 13:47:01 +0700 Subject: [PATCH 12/14] feat: support tag standard for q tag --- .../src/protocol/event/tag/standard.rs | 24 +++++++++++++++ crates/nostr/src/event/tag/kind.rs | 8 +++++ crates/nostr/src/event/tag/standard.rs | 29 +++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs index 79fa27a0d..abce1cc7b 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs @@ -40,6 +40,12 @@ pub enum TagStandard { /// Whether the e tag is an uppercase E or not uppercase: bool, }, + Quote { + event_id: Arc, + relay_url: Option, + /// Should be the public key of the author of the referenced event + public_key: Option>, + }, /// Git clone (`clone` tag) /// /// @@ -295,6 +301,15 @@ impl From for TagStandard { public_key: public_key.map(|p| Arc::new(p.into())), uppercase, }, + tag::TagStandard::Quote { + event_id, + relay_url, + public_key, + } => Self::Quote { + event_id: Arc::new(event_id.into()), + relay_url: relay_url.map(|u| u.to_string()), + public_key: public_key.map(|p| Arc::new(p.into())), + }, tag::TagStandard::GitClone(urls) => Self::GitClone { urls: urls.into_iter().map(|r| r.to_string()).collect(), }, @@ -502,6 +517,15 @@ impl TryFrom for tag::TagStandard { public_key: public_key.map(|p| **p), uppercase, }), + TagStandard::Quote { + event_id, + relay_url, + public_key, + } => Ok(Self::Quote { + event_id: **event_id, + relay_url: relay_url.map(UncheckedUrl::from), + public_key: public_key.map(|p| **p), + }), TagStandard::GitClone { urls } => { let mut parsed_urls: Vec = Vec::with_capacity(urls.len()); for url in urls.into_iter() { diff --git a/crates/nostr/src/event/tag/kind.rs b/crates/nostr/src/event/tag/kind.rs index 9ae9c453a..5f656d800 100644 --- a/crates/nostr/src/event/tag/kind.rs +++ b/crates/nostr/src/event/tag/kind.rs @@ -166,6 +166,14 @@ impl<'a> TagKind<'a> { Self::SingleLetter(SingleLetterTag::lowercase(Alphabet::T)) } + /// Construct `q` kind + /// + /// Shorthand for `TagKind::SingleLetter(SingleLetterTag::lowercase(Alphabet::Q))`. + #[inline] + pub fn q() -> Self { + Self::SingleLetter(SingleLetterTag::lowercase(Alphabet::Q)) + } + /// Construct [`TagKind::Custom`] /// /// Shorthand for `TagKind::Custom(Cow::from(...))`. diff --git a/crates/nostr/src/event/tag/standard.rs b/crates/nostr/src/event/tag/standard.rs index 60abdb776..802bf6182 100644 --- a/crates/nostr/src/event/tag/standard.rs +++ b/crates/nostr/src/event/tag/standard.rs @@ -47,6 +47,15 @@ pub enum TagStandard { /// Whether the e tag is an uppercase E or not uppercase: bool, }, + /// Quote + /// + /// + Quote { + event_id: EventId, + relay_url: Option, + /// Should be the public key of the author of the referenced event + public_key: Option, + }, /// Report event /// /// @@ -468,6 +477,10 @@ impl TagStandard { character: Alphabet::E, uppercase: *uppercase, }), + Self::Quote { .. } => TagKind::SingleLetter(SingleLetterTag { + character: Alphabet::E, + uppercase: false, + }), Self::EventReport(..) => TagKind::SingleLetter(SingleLetterTag::lowercase(Alphabet::E)), Self::GitClone(..) => TagKind::Clone, Self::GitCommit(..) => TagKind::Commit, @@ -617,6 +630,22 @@ impl From for Vec { } tag } + TagStandard::Quote { + event_id, + relay_url, + public_key, + .. + } => { + let mut tag = vec![tag_kind, event_id.to_hex()]; + if let Some(relay_url) = relay_url { + tag.push(relay_url.to_string()); + } + if let Some(public_key) = public_key { + tag.resize_with(3, String::new); + tag.push(public_key.to_string()); + } + tag + } TagStandard::PublicKey { public_key, relay_url, From e074fa400d1ed22d7e7240d7eb456795c97df706 Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 14:15:34 +0700 Subject: [PATCH 13/14] feat: root must be same with parent if user not provide --- crates/nostr/src/event/builder.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index b04ede778..96237eaef 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -420,6 +420,7 @@ impl EventBuilder { /// If no `root` is passed, the `rely_to` will be used for root `e` tag. /// /// + #[deprecated(since = "0.36.0", note = "Use `EventBuilder::comment` method instead.")] pub fn text_note_reply( content: S, reply_to: &Event, @@ -525,6 +526,7 @@ impl EventBuilder { public_key: Some(root.pubkey), uppercase: true, })); + // Kind tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { kind: root.kind, @@ -544,6 +546,21 @@ impl EventBuilder { }) .cloned(), ); + } else { + // ID and author + tags.push(Tag::from_standardized_without_cell(TagStandard::Event { + event_id: comment_to.id, + relay_url: relay_url.clone(), + marker: None, + public_key: Some(comment_to.pubkey), + uppercase: true, + })); + + // Kind + tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { + kind: comment_to.kind, + uppercase: true, + })); } // Add `e` tag of event author @@ -554,6 +571,7 @@ impl EventBuilder { public_key: Some(comment_to.pubkey), uppercase: false, })); + // Add `k` tag of event kind tags.push(Tag::from_standardized_without_cell(TagStandard::Kind { kind: comment_to.kind, From 9afd230b93494390438c69fbd6f2a7de79fa0af8 Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 9 Nov 2024 14:40:46 +0700 Subject: [PATCH 14/14] fix: remove deprecated --- crates/nostr/src/event/builder.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/nostr/src/event/builder.rs b/crates/nostr/src/event/builder.rs index 96237eaef..fbd43e18f 100644 --- a/crates/nostr/src/event/builder.rs +++ b/crates/nostr/src/event/builder.rs @@ -420,7 +420,6 @@ impl EventBuilder { /// If no `root` is passed, the `rely_to` will be used for root `e` tag. /// /// - #[deprecated(since = "0.36.0", note = "Use `EventBuilder::comment` method instead.")] pub fn text_note_reply( content: S, reply_to: &Event,