@@ -2127,13 +2127,27 @@ class ClientImpl extends RustOpaque implements Client {
2127
2127
NostrSdk .instance.api.rust_arc_decrement_strong_count_ClientPtr,
2128
2128
);
2129
2129
2130
+ /// Add relay
2131
+ ///
2132
+ /// Relays added with this method will have both `READ` and `WRITE` flags enabled.
2133
+ ///
2134
+ /// If the relay already exists, the flags will be updated and `false` returned.
2135
+ ///
2136
+ /// If are set pool subscriptions, the new added relay will inherit them.
2137
+ ///
2138
+ /// Connection is **NOT** automatically started with relay, remember to call `connect` method!
2130
2139
Future <bool > addRelay ({required String url}) =>
2131
2140
NostrSdk .instance.api.crateApiClientClientAddRelay (that: this , url: url);
2132
2141
2142
+ /// Connect to all added relays
2133
2143
Future <void > connect () => NostrSdk .instance.api.crateApiClientClientConnect (
2134
2144
that: this ,
2135
2145
);
2136
2146
2147
+ /// Send event
2148
+ ///
2149
+ /// Send `Event` to all relays with `WRITE` flag.
2150
+ /// If `gossip` option is enabled, the event will be sent also to NIP65 relays (automatically discovered).
2137
2151
Future <String > sendEvent ({required Event event}) => NostrSdk .instance.api
2138
2152
.crateApiClientClientSendEvent (that: this , event: event);
2139
2153
}
@@ -2157,10 +2171,12 @@ class EventImpl extends RustOpaque implements Event {
2157
2171
NostrSdk .instance.api.rust_arc_decrement_strong_count_EventPtr,
2158
2172
);
2159
2173
2174
+ /// Serialize as JSON
2160
2175
String asJson () => NostrSdk .instance.api.crateApiProtocolEventEventAsJson (
2161
2176
that: this ,
2162
2177
);
2163
2178
2179
+ /// Serialize as pretty JSON
2164
2180
String asPrettyJson () =>
2165
2181
NostrSdk .instance.api.crateApiProtocolEventEventAsPrettyJson (
2166
2182
that: this ,
@@ -2171,15 +2187,18 @@ class EventImpl extends RustOpaque implements Event {
2171
2187
that: this ,
2172
2188
);
2173
2189
2190
+ /// Get event content
2174
2191
String content () => NostrSdk .instance.api.crateApiProtocolEventEventContent (
2175
2192
that: this ,
2176
2193
);
2177
2194
2195
+ /// Get UNIX timestamp
2178
2196
BigInt createdAt () =>
2179
2197
NostrSdk .instance.api.crateApiProtocolEventEventCreatedAt (
2180
2198
that: this ,
2181
2199
);
2182
2200
2201
+ /// Get event ID
2183
2202
String id () => NostrSdk .instance.api.crateApiProtocolEventEventId (
2184
2203
that: this ,
2185
2204
);
@@ -2200,30 +2219,33 @@ class EventImpl extends RustOpaque implements Event {
2200
2219
that: this ,
2201
2220
);
2202
2221
2222
+ /// Get event kind
2203
2223
int kind () => NostrSdk .instance.api.crateApiProtocolEventEventKind (
2204
2224
that: this ,
2205
2225
);
2206
2226
2227
+ /// Get event signature
2207
2228
String signature () =>
2208
2229
NostrSdk .instance.api.crateApiProtocolEventEventSignature (
2209
2230
that: this ,
2210
2231
);
2211
2232
2233
+ /// Get event tags
2212
2234
List <Tag > tags () => NostrSdk .instance.api.crateApiProtocolEventEventTags (
2213
2235
that: this ,
2214
2236
);
2215
2237
2216
- /// Verify both `EventId` and `Signature`
2238
+ /// Verify both the event ID and the signature
2217
2239
void verify () => NostrSdk .instance.api.crateApiProtocolEventEventVerify (
2218
2240
that: this ,
2219
2241
);
2220
2242
2221
- /// Verify if the `EventId` it's composed correctly
2243
+ /// Verify if the event ID it's composed correctly
2222
2244
bool verifyId () => NostrSdk .instance.api.crateApiProtocolEventEventVerifyId (
2223
2245
that: this ,
2224
2246
);
2225
2247
2226
- /// Verify only event `Signature`
2248
+ /// Verify only the event signature
2227
2249
bool verifySignature () =>
2228
2250
NostrSdk .instance.api.crateApiProtocolEventEventVerifySignature (
2229
2251
that: this ,
@@ -2249,11 +2271,13 @@ class KeysImpl extends RustOpaque implements Keys {
2249
2271
NostrSdk .instance.api.rust_arc_decrement_strong_count_KeysPtr,
2250
2272
);
2251
2273
2274
+ /// Get public key
2252
2275
PublicKey publicKey () =>
2253
2276
NostrSdk .instance.api.crateApiProtocolKeyKeysPublicKey (
2254
2277
that: this ,
2255
2278
);
2256
2279
2280
+ /// Get secret key
2257
2281
SecretKey secretKey () =>
2258
2282
NostrSdk .instance.api.crateApiProtocolKeyKeysSecretKey (
2259
2283
that: this ,
@@ -2279,16 +2303,19 @@ class PublicKeyImpl extends RustOpaque implements PublicKey {
2279
2303
NostrSdk .instance.api.rust_arc_decrement_strong_count_PublicKeyPtr,
2280
2304
);
2281
2305
2306
+ /// Serialize to bech32
2282
2307
String toBech32 () =>
2283
2308
NostrSdk .instance.api.crateApiProtocolKeyPublicKeyPublicKeyToBech32 (
2284
2309
that: this ,
2285
2310
);
2286
2311
2312
+ /// Serialize to hex
2287
2313
String toHex () =>
2288
2314
NostrSdk .instance.api.crateApiProtocolKeyPublicKeyPublicKeyToHex (
2289
2315
that: this ,
2290
2316
);
2291
2317
2318
+ /// Serialize as nostr URI
2292
2319
String toNostrUri () =>
2293
2320
NostrSdk .instance.api.crateApiProtocolKeyPublicKeyPublicKeyToNostrUri (
2294
2321
that: this ,
@@ -2314,11 +2341,13 @@ class SecretKeyImpl extends RustOpaque implements SecretKey {
2314
2341
NostrSdk .instance.api.rust_arc_decrement_strong_count_SecretKeyPtr,
2315
2342
);
2316
2343
2344
+ /// Serialize to bech32
2317
2345
String toBech32 () =>
2318
2346
NostrSdk .instance.api.crateApiProtocolKeySecretKeySecretKeyToBech32 (
2319
2347
that: this ,
2320
2348
);
2321
2349
2350
+ /// Serialize to hex
2322
2351
String toSecretHex () =>
2323
2352
NostrSdk .instance.api.crateApiProtocolKeySecretKeySecretKeyToSecretHex (
2324
2353
that: this ,
0 commit comments