1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
//! The coconut bandwidth component of the Rust SDK for the Nym platform
//!
//!
//! # Basic example
//!
//! ```no_run
//! use nym_sdk::mixnet::{self, MixnetMessageSender};
//! use nym_credentials_interface::TicketType;
//!
//! #[tokio::main]
//! async fn main() {
//! let mixnet_client = mixnet::MixnetClientBuilder::new_ephemeral()
//! .enable_credentials_mode()
//! .build()
//! .unwrap();
//!
//! let bandwidth_client = mixnet_client.create_bandwidth_client(String::from("my super secret mnemonic"), TicketType::V1MixnetEntry).await.unwrap();
//!
//! // Get a bandwidth credential for the mixnet_client
//! bandwidth_client.acquire().await.unwrap();
//!
//! // Connect using paid bandwidth credential
//! let mut client = mixnet_client.connect_to_mixnet().await.unwrap();
//!
//! let our_address = client.nym_address();
//!
//! // Send a message throughout the mixnet to ourselves
//! client.send_plain_message(*our_address, "hello there").await.unwrap();
//!
//! println!("Waiting for message");
//! if let Some(received) = client.wait_for_messages().await {
//! for r in received {
//! println!("Received: {}", String::from_utf8_lossy(&r.message));
//! }
//! }
//!
//! client.disconnect().await;
//! }
//! ```
pub use BandwidthAcquireClient;
pub use BandwidthImporter;