audit_trails/client/mod.rs
1// Copyright 2020-2026 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4//! Client implementations for interacting with audit trails on the IOTA ledger.
5//!
6//! [`AuditTrailClientReadOnly`] is the entry point for read-only inspection and typed trail handles.
7//! [`AuditTrailClient`] wraps a read-only client together with a signer so it can build write
8//! transactions through the shared transaction infrastructure.
9
10use iota_interaction::IotaClientTrait;
11use product_common::network_name::NetworkName;
12
13use crate::error::Error;
14use crate::iota_interaction_adapter::IotaClientAdapter;
15
16/// A signing client that can create audit-trail transaction builders.
17pub mod full_client;
18/// A read-only client that resolves package IDs and executes inspected calls.
19pub mod read_only;
20
21pub use full_client::*;
22pub use read_only::*;
23
24/// Resolves the network name reported by the given IOTA client.
25async fn network_id(iota_client: &IotaClientAdapter) -> Result<NetworkName, Error> {
26 let network_id = iota_client
27 .read_api()
28 .get_chain_identifier()
29 .await
30 .map_err(|e| Error::RpcError(e.to_string()))?;
31 Ok(network_id.try_into().expect("chain ID is a valid network name"))
32}