sdk

Radroots SDK and bindings
git clone https://radroots.dev/git/sdk.git
Log | Files | Refs | README

commit 5a8c47f2a43bed9e0d8e41cc9787287b8f9944f9
parent b0b478041758ff997c99b45f682ffa7e9681adc3
Author: triesap <tyson@radroots.org>
Date:   Thu, 30 Jul 2026 07:36:01 +0000

sdk: adapt to persistence-free trade boundary

- stop enabling the retired trade event-store feature
- keep seller authorization at the SDK orchestration boundary
- pass validated public keys into trade canonicalization
- refresh the lockfile for the reduced trade dependency graph

Diffstat:
MCargo.lock | 3---
Mcrates/sdk/Cargo.toml | 1-
Mcrates/sdk/src/error.rs | 4----
Mcrates/sdk/src/listings_runtime.rs | 9++++++++-
Mcrates/sdk/tests/unit/error_tests.rs | 12------------
5 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -2428,16 +2428,13 @@ version = "0.1.0-alpha" dependencies = [ "base64 0.22.1", "hex", - "radroots_authority", "radroots_core", "radroots_event", "radroots_event_codec", - "radroots_event_store", "radroots_identity", "serde", "serde_json", "sha2", - "sqlx", "thiserror 1.0.69", ] diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml @@ -98,7 +98,6 @@ runtime = [ "radroots_transport_nostr/std", "radroots_transport_nostr/storage", "radroots_transport_nostr/runtime-tokio", - "radroots_trade/event_store", ] local-signer = ["runtime", "radroots_authority/local_signer"] transport-nostr-runtime = [ diff --git a/crates/sdk/src/error.rs b/crates/sdk/src/error.rs @@ -1197,10 +1197,6 @@ impl From<radroots_trade::operational_listing::RadrootsOperationalListingEditErr error: radroots_trade::operational_listing::RadrootsOperationalListingEditError, ) -> Self { match error { - radroots_trade::operational_listing::RadrootsOperationalListingEditError::ActorRoleUnsatisfied { required_role } => Self::UnauthorizedActor { - operation: "listing.prepare_publish".to_owned(), - reason: format!("missing role {required_role:?}"), - }, radroots_trade::operational_listing::RadrootsOperationalListingEditError::InvalidModel(error) => Self::ListingValidation { kind: RadrootsSdkListingValidationErrorKind::from(&error), message: error.to_string(), diff --git a/crates/sdk/src/listings_runtime.rs b/crates/sdk/src/listings_runtime.rs @@ -10,6 +10,7 @@ use crate::{ use radroots_authority::{RadrootsActorContext, RadrootsEventSigner}; #[cfg(feature = "runtime")] use radroots_event::{ + contract::AuthorRole, draft::EventDraft, envelope::kind::KIND_CLASSIFIED_LISTING, id::{ClassifiedListingAddress, EventId}, @@ -340,7 +341,13 @@ fn canonical_listing_edit( actor: &RadrootsActorContext, document: RadrootsOperationalListingEditDocumentV1, ) -> Result<RadrootsOperationalListingCanonicalEdit, RadrootsSdkError> { - canonicalize_operational_listing_edit(actor, document).map_err(Into::into) + if !actor.satisfies(AuthorRole::Seller) { + return Err(RadrootsSdkError::UnauthorizedActor { + operation: "listing.prepare_publish".to_owned(), + reason: "missing role Seller".to_owned(), + }); + } + canonicalize_operational_listing_edit(*actor.pubkey(), document).map_err(Into::into) } #[cfg(feature = "runtime")] diff --git a/crates/sdk/tests/unit/error_tests.rs b/crates/sdk/tests/unit/error_tests.rs @@ -5,7 +5,6 @@ use super::{ use crate::privacy::{PrivacyPreflightStatus, ProductSensitivityField}; use crate::transport::ReticulumBehavior; use radroots_authority::RadrootsAuthorityError; -use radroots_event::contract::AuthorRole; use radroots_geocoder::{GeoNamesAssetFetcher, GeoNamesBlockingHttpFetcher, GeocoderError}; use std::collections::BTreeSet; @@ -32,17 +31,6 @@ fn authority_error_conversion_redacts_pubkey_mismatches_and_falls_back() { #[test] fn listing_and_store_errors_convert_to_sdk_error_classes() { - let draft = RadrootsSdkError::from( - radroots_trade::operational_listing::RadrootsOperationalListingEditError::ActorRoleUnsatisfied { - required_role: AuthorRole::Seller, - }, - ); - assert!(matches!( - draft, - RadrootsSdkError::UnauthorizedActor { ref operation, ref reason } - if operation == "listing.prepare_publish" && reason == "missing role Seller" - )); - let draft_fallback = RadrootsSdkError::from( radroots_trade::operational_listing::RadrootsOperationalListingEditError::InvalidFarmPubkey( radroots_identity::PublicKey::from_hex("bad").expect_err("invalid public key"),