tx3_sdk/lib.rs
1//! # TX3 Rust SDK
2//!
3//! Ergonomic Rust SDK for interacting with TX3 protocols, TII files, and TRP servers.
4//!
5//! TX3 is a DSL and protocol suite for defining and executing UTxO-based transactions in a
6//! declarative, type-safe way.
7//!
8//! ## Quick start
9//!
10//! ```ignore
11//! use serde_json::json;
12//! use tx3_sdk::{CardanoSigner, Party, PollConfig};
13//!
14//! let signer = CardanoSigner::from_mnemonic(
15//! "addr_test1...",
16//! "word1 word2 ... word24",
17//! )?;
18//!
19//! let tx3 = tx3_sdk::tii::Protocol::from_file("./examples/transfer.tii")?
20//! .client()
21//! .trp_endpoint("https://trp.example.com")
22//! .with_profile("preprod")
23//! .with_party("sender", Party::signer(signer))
24//! .with_party("receiver", Party::address("addr_test1..."))
25//! .with_party("middleman", Party::address("addr_test1..."))
26//! .build()?;
27//!
28//! let status = tx3
29//! .tx("transfer")?
30//! .arg("quantity", json!(10_000_000))
31//! .resolve()
32//! .await?
33//! .sign()?
34//! .submit()
35//! .await?
36//! .wait_for_confirmed(PollConfig::default())
37//! .await?;
38//!
39//! println!("Confirmed at stage: {:?}", status.stage);
40//! ```
41//!
42//! ## Links
43//!
44//! - [TX3 Documentation](https://docs.txpipe.io/tx3)
45
46pub mod core;
47pub mod facade;
48pub mod tii;
49pub mod trp;
50
51pub use facade::signer::{CardanoSigner, Ed25519Signer};
52pub use facade::{
53 Error, Party, PollConfig, Profile, ResolvedTx, SignRequest, SignedTx, Signer, SubmittedTx,
54 Tx3Client, Tx3ClientBuilder, TxBuilder, WitnessInfo,
55};