commit 7364cd90f8c1760f1a8cafd72528e1bf8b8798ad
parent 7bec72501c3253b75040097c68f478b12714789a
Author: triesap <tyson@radroots.org>
Date: Fri, 31 Jul 2026 09:03:21 +0000
nostr: remove live relay-client dependencies
- Route SDK client adapters through radroots_transport_nostr.
- Replace portable-client features with transport-owned feature wiring.
- Normalize adapter tests against the owned transport error contract.
- Refresh lockfile and API-boundary expectations for the move.
Diffstat:
5 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml
@@ -52,7 +52,13 @@ signing = [
"radroots_protocol/std",
"radroots_signing/std",
]
-transport-nostr-client = ["signing", "std", "serde_json", "radroots_nostr/client"]
+transport-nostr-client = [
+ "signing",
+ "std",
+ "serde_json",
+ "dep:radroots_transport_nostr",
+ "radroots_transport_nostr/client",
+]
radrootsd-execution = [
"std",
"serde_json",
@@ -112,7 +118,6 @@ local-signer = ["runtime", "signing", "radroots_nostr/signing"]
transport-nostr-runtime = [
"runtime",
"dep:radroots_nostr",
- "radroots_nostr/client",
"radroots_transport_nostr/client",
]
local-runtime = [
diff --git a/crates/sdk/src/adapters/nostr.rs b/crates/sdk/src/adapters/nostr.rs
@@ -1,17 +1,16 @@
use core::time::Duration;
-use radroots_nostr::prelude::{
- RadrootsNostrClient, RadrootsNostrClientOptions, RadrootsNostrError, RadrootsNostrEvent,
- RadrootsNostrEventId, RadrootsNostrKeys, RadrootsNostrOutput,
+use radroots_nostr::prelude::{RadrootsNostrEvent, RadrootsNostrEventId, RadrootsNostrKeys};
+use radroots_transport_nostr::{
+ RadrootsNostrClient, RadrootsNostrClientOptions, RadrootsNostrOutput,
+ RadrootsRelayTransportError,
};
pub fn signerless_client() -> RadrootsNostrClient {
RadrootsNostrClient::new_signerless()
}
-pub fn signerless_client_with_options(
- options: RadrootsNostrClientOptions,
-) -> Result<RadrootsNostrClient, RadrootsNostrError> {
+pub fn signerless_client_with_options(options: RadrootsNostrClientOptions) -> RadrootsNostrClient {
RadrootsNostrClient::new_signerless_with_options(options)
}
@@ -23,7 +22,7 @@ pub async fn configure_write_relays(
client: &RadrootsNostrClient,
relay_urls: &[String],
connect_timeout: Duration,
-) -> Result<(), RadrootsNostrError> {
+) -> Result<(), RadrootsRelayTransportError> {
for relay_url in relay_urls {
client.add_write_relay(relay_url).await?;
}
@@ -36,7 +35,7 @@ pub async fn connected_client_from_keys(
keys: RadrootsNostrKeys,
relay_urls: &[String],
connect_timeout: Duration,
-) -> Result<RadrootsNostrClient, RadrootsNostrError> {
+) -> Result<RadrootsNostrClient, RadrootsRelayTransportError> {
let client = client_from_keys(keys);
configure_write_relays(&client, relay_urls, connect_timeout).await?;
Ok(client)
@@ -57,7 +56,7 @@ pub async fn connected_relay_urls(client: &RadrootsNostrClient) -> Vec<String> {
pub async fn publish_signed_event(
client: &RadrootsNostrClient,
event: &RadrootsNostrEvent,
-) -> Result<RadrootsNostrOutput<RadrootsNostrEventId>, RadrootsNostrError> {
+) -> Result<RadrootsNostrOutput<RadrootsNostrEventId>, RadrootsRelayTransportError> {
client.send_event(event).await
}
diff --git a/crates/sdk/src/sync_runtime.rs b/crates/sdk/src/sync_runtime.rs
@@ -15,8 +15,6 @@ use crate::{RadrootsdExecutionAuth, RadrootsdExecutionProfile};
use radroots_event::id::EventId;
#[cfg(feature = "runtime")]
use radroots_event_store::{RADROOTS_EVENT_STORE_QUERY_LIMIT_MAX, RadrootsEventStoreStatusSummary};
-#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))]
-use radroots_nostr::prelude::RadrootsNostrClient;
#[cfg(all(feature = "runtime", feature = "radrootsd-execution"))]
use radroots_outbox::RadrootsOutboxClaimedEvent;
#[cfg(feature = "runtime")]
@@ -44,7 +42,9 @@ use radroots_transport::{
#[cfg(all(feature = "runtime", feature = "radrootsd-execution"))]
use radroots_transport::{RadrootsTransportSatisfactionClass, RadrootsTransportSatisfactionPolicy};
#[cfg(all(feature = "runtime", feature = "transport-nostr-runtime"))]
-use radroots_transport_nostr::{RadrootsNostrClientPublishAdapter, RadrootsNostrTransport};
+use radroots_transport_nostr::{
+ RadrootsNostrClient, RadrootsNostrClientPublishAdapter, RadrootsNostrTransport,
+};
#[cfg(feature = "runtime")]
use radroots_transport_nostr::{
RadrootsOutboxPublishPolicy, RadrootsOutboxPublishReceipt, RadrootsOutboxPublishTargetReceipt,
diff --git a/crates/sdk/tests/unit/adapters_nostr_tests.rs b/crates/sdk/tests/unit/adapters_nostr_tests.rs
@@ -4,7 +4,7 @@ use super::{
};
use core::time::Duration;
use nostr::{EventBuilder, Keys, Kind};
-use radroots_nostr::prelude::RadrootsNostrClientOptions;
+use radroots_transport_nostr::{RadrootsNostrClientOptions, RadrootsRelayTransportError};
use tokio::runtime::Runtime;
#[test]
@@ -13,8 +13,7 @@ fn client_constructors_build_without_runtime_net() {
let _client = client_from_keys(keys);
let _signerless = signerless_client();
let _signerless_with_options =
- signerless_client_with_options(RadrootsNostrClientOptions::new())
- .expect("signerless client with options");
+ signerless_client_with_options(RadrootsNostrClientOptions::new());
}
#[test]
@@ -42,7 +41,7 @@ fn relay_helpers_accept_empty_relay_sets_without_network_endpoints() {
let error = configure_write_relays(&client, &invalid_relays, Duration::from_millis(1))
.await
.expect_err("invalid relay");
- assert!(format!("{error:?}").contains("Url"));
+ assert!(matches!(error, RadrootsRelayTransportError::Client(_)));
let connected_error = match connected_client_from_keys(
keys.clone(),
&invalid_relays,
@@ -53,7 +52,10 @@ fn relay_helpers_accept_empty_relay_sets_without_network_endpoints() {
Ok(_) => panic!("expected invalid connected relay"),
Err(error) => error,
};
- assert!(format!("{connected_error:?}").contains("Url"));
+ assert!(matches!(
+ connected_error,
+ RadrootsRelayTransportError::Client(_)
+ ));
let disconnected = client_from_keys(keys.clone());
disconnected
@@ -78,6 +80,6 @@ fn relay_helpers_accept_empty_relay_sets_without_network_endpoints() {
let error = publish_signed_event(&connected, &signed)
.await
.expect_err("publish without relays");
- assert!(format!("{error:?}").contains("NoRelaysSpecified"));
+ assert!(matches!(error, RadrootsRelayTransportError::Client(_)));
});
}
diff --git a/tools/sdk_xtask_import/src/check.rs b/tools/sdk_xtask_import/src/check.rs
@@ -564,7 +564,6 @@ fn check_sdk_feature_matrix(root: &Path) -> Result<(), String> {
for entry in [
"runtime",
"dep:radroots_nostr",
- "radroots_nostr/client",
"radroots_transport_nostr/client",
] {
require_feature_entry(&nostr_runtime, "transport-nostr-runtime", entry)?;