Skip to content

Commit b82649d

Browse files
JSKittyclaude
andcommitted
fix: disambiguate nostr_sdk Error types for Rust 1.94 compat
Rust 1.94 resolves the bare `Error` from `use nostr_sdk::prelude::*` to `nostr::event::builder::Error` instead of `nostr_sdk::client::Error`, breaking the inbox relay send functions. Use explicit types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 07ebbf5 commit b82649d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src-tauri/src/inbox_relays.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub(crate) async fn send_event_first_ok(
268268
client: &Client,
269269
urls: Vec<RelayUrl>,
270270
event: &Event,
271-
) -> Result<Output<EventId>, Error> {
271+
) -> Result<Output<EventId>, nostr_sdk::client::Error> {
272272
let pool = client.pool();
273273
let relays = pool.relays().await;
274274
let event_id = event.id;
@@ -331,7 +331,7 @@ pub(crate) async fn send_event_first_ok(
331331
pub(crate) async fn send_event_pool_first_ok(
332332
client: &Client,
333333
event: &Event,
334-
) -> Result<Output<EventId>, Error> {
334+
) -> Result<Output<EventId>, nostr_sdk::client::Error> {
335335
let pool = client.pool();
336336
let relays = pool.relays().await;
337337
let write_urls: Vec<RelayUrl> = relays
@@ -354,16 +354,16 @@ pub async fn send_gift_wrap(
354354
recipient: &PublicKey,
355355
rumor: UnsignedEvent,
356356
extra_tags: impl IntoIterator<Item = Tag>,
357-
) -> Result<Output<EventId>, Error> {
357+
) -> Result<Output<EventId>, String> {
358358
// Wrap once upfront so we can reuse on fallback (avoids ~165µs re-encrypt)
359-
let signer = client.signer().await?;
360-
let event = EventBuilder::gift_wrap(&signer, recipient, rumor, extra_tags).await?;
359+
let signer = client.signer().await.map_err(|e| e.to_string())?;
360+
let event = EventBuilder::gift_wrap(&signer, recipient, rumor, extra_tags).await.map_err(|e| e.to_string())?;
361361

362362
let inbox_strs = get_or_fetch_inbox_relays(client, recipient).await;
363363

364364
if inbox_strs.is_empty() {
365365
// No 10050 found — broadcast to pool
366-
return send_event_pool_first_ok(client, &event).await;
366+
return send_event_pool_first_ok(client, &event).await.map_err(|e| e.to_string());
367367
}
368368

369369
let inbox: Vec<RelayUrl> = inbox_strs
@@ -385,7 +385,7 @@ pub async fn send_gift_wrap(
385385
"[InboxRelays] Inbox relays failed for {}, falling back to pool broadcast",
386386
recipient
387387
);
388-
send_event_pool_first_ok(client, &event).await
388+
send_event_pool_first_ok(client, &event).await.map_err(|e| e.to_string())
389389
}
390390
}
391391
}

0 commit comments

Comments
 (0)