whisky/
lib.rs

1//! # whisky
2//!
3//! `whisky` is built with the same pattern as [MeshJS's lower level APIs](https://meshjs.dev/apis/transaction/builderExample) where Rust Cardano developer can import directly for use.
4//!
5//! ## Install
6//!
7//! In your Rust project, run the below
8//!
9//! ```sh
10//! cargo add whisky
11//! ```
12//!
13//! or add the dependency in `Cargo.toml`
14//!
15//! ```toml
16//! [dependencies]
17//! whisky = "^<the-latest-version>"
18//! ```
19//!
20//! ## Feature Flags
21//!
22//! By default, all features are enabled. You can selectively enable features:
23//!
24//! ```toml
25//! # Full (default) - all features
26//! whisky = "1.0.18"
27//!
28//! # Just common types (minimal)
29//! whisky = { version = "1.0.18", default-features = false }
30//!
31//! # Wallet only (includes csl + common)
32//! whisky = { version = "1.0.18", default-features = false, features = ["wallet"] }
33//!
34//! # Provider only (includes csl + common)
35//! whisky = { version = "1.0.18", default-features = false, features = ["provider"] }
36//!
37//! # CSL only (transaction building without wallet/provider)
38//! whisky = { version = "1.0.18", default-features = false, features = ["csl"] }
39//! ```
40//!
41//! ## Getting Started
42//!
43//! ```rust,ignore
44//! use whisky::*;
45//!
46//! async fn my_first_whisky_tx(
47//!     recipient_address: &str,
48//!     my_address: &str,
49//!     inputs: &[UTxO],
50//! ) -> String {
51//!     let mut mesh = TxBuilder::new_core();
52//!     mesh.tx_out(
53//!         &recipient_address,
54//!         &[Asset::new_from_str("lovelace", "1000000")],
55//!     )
56//!         .change_address(my_address)
57//!         .select_utxos_from(inputs, 5000000)
58//!         .complete(None)
59//!         .await;
60//!     mesh.tx_hex()
61//! }
62//! ```
63//!
64//! ## APIs
65//!
66//! All user facing APIs are documentation at the [builder interface](builder/struct.TxBuilder.html).
67//!
68
69// Self-reference alias to allow proc macros to use ::whisky:: path within this crate
70extern crate self as whisky;
71
72// Data module is always available (uses whisky_common + whisky_macros)
73pub mod data;
74
75// CSL-dependent modules
76#[cfg(feature = "csl")]
77pub mod builder;
78#[cfg(feature = "csl")]
79pub mod parser;
80#[cfg(feature = "csl")]
81pub mod transaction;
82#[cfg(feature = "csl")]
83pub mod utils;
84
85// Services require both csl and provider
86#[cfg(all(feature = "csl", feature = "provider"))]
87pub mod services;
88
89// Always re-export common and macros
90pub use whisky_common::*;
91pub use whisky_macros::*;
92
93// CSL re-exports
94#[cfg(feature = "csl")]
95pub use builder::*;
96#[cfg(feature = "csl")]
97pub use parser::*;
98#[cfg(feature = "csl")]
99pub use transaction::*;
100#[cfg(feature = "csl")]
101pub use utils::*;
102#[cfg(feature = "csl")]
103pub use whisky_csl::*;
104
105// Wallet re-exports
106#[cfg(feature = "wallet")]
107pub use whisky_wallet::*;
108
109// Provider re-exports
110#[cfg(feature = "provider")]
111pub use whisky_provider::*;