Skip to main content

canton_admin/
lib.rs

1//! Canton administrative client: party management, user self-inspect, and
2//! topology read.
3//!
4//! Canton exposes these across **two** gRPC endpoints, so this crate provides
5//! two clients:
6//!
7//! - [`AdminClient`] — party management ([`PartyManagementService`]) and user
8//!   self-inspect ([`UserManagementService`]), served on the **Ledger API**
9//!   port (e.g. `:3901`), the same channel/auth as the ledger client. Party
10//!   admin RPCs require the `ParticipantAdmin` right; self-inspect
11//!   ([`AdminClient::current_user`] / [`AdminClient::current_user_rights`])
12//!   works with any authenticated token.
13//! - [`TopologyClient`] — topology **read** (party→participant mappings,
14//!   namespace delegations, vetted packages) via `TopologyManagerReadService`,
15//!   served on the Canton **admin API** port (e.g. `:3902`).
16//!
17//! Both build on the shared [`canton_core::Config`] (endpoint, auth, TLS,
18//! retry).
19//!
20//! [`PartyManagementService`]: https://docs.daml.com
21//! [`UserManagementService`]: https://docs.daml.com
22//!
23//! ```no_run
24//! # async fn run() -> canton_admin::Result<()> {
25//! use canton_admin::{AdminClient, Config};
26//!
27//! let admin = AdminClient::connect_lazy(Config::new("http://localhost:3901"))?;
28//! let me = admin.current_user().await?;
29//! println!("acting as: {:?}", admin.acting_parties().await?);
30//! # let _ = me;
31//! # Ok(())
32//! # }
33//! ```
34#![cfg_attr(docsrs, feature(doc_cfg))]
35
36mod client;
37mod topology;
38
39pub use canton_core::{Config, Error, Result, RetryConfig, TlsConfig};
40pub use canton_proto::com::daml::ledger::api::v2::PackageStatus;
41pub use client::AdminClient;
42pub use topology::{Entry, Store, TopologyClient};
43
44/// Generated Ledger API admin protobuf types (party & user management).
45pub use canton_proto::com::daml::ledger::api::v2::admin as proto;
46/// Generated Canton protocol types (topology mapping items).
47pub use canton_proto::com::digitalasset::canton::protocol::v30 as protocol_proto;
48/// Generated Canton admin-API topology types (query/result envelopes).
49pub use canton_proto::com::digitalasset::canton::topology::admin::v30 as topology_proto;