Skip to main content

mina_tx_type/
lib.rs

1//! Mina Protocol transaction types.
2//!
3//! This crate provides `no_std` compatible transaction type definitions for
4//! the Mina Protocol. It is designed for use by external projects that need
5//! access to Mina transaction types without requiring the full ledger crate's
6//! dependencies.
7//!
8//! # Features
9//!
10//! - **`no_std` compatible**: Works in embedded and constrained environments
11//!   such as hardware wallets and WASM runtimes.
12//! - **Standalone**: Minimal dependencies, focused purely on type definitions.
13//! - **Documented**: All types and fields include rustdoc documentation.
14//!
15//! # Transaction Types
16//!
17//! Currently supported transaction types:
18//!
19//! - [`Coinbase`]: Block reward transactions
20//! - [`CoinbaseFeeTransfer`]: Fee transfers within coinbase transactions
21//!
22//! # Currency Types
23//!
24//! - [`Amount`]: Currency amounts in nanomina
25//! - [`Fee`]: Transaction fees in nanomina
26//! - [`Signed`]: Signed quantities with separate magnitude and sign
27//! - [`Sign`]: Sign indicator (positive or negative)
28//!
29//! # Example
30//!
31//! ```
32//! use mina_tx_type::{Amount, Fee, Coinbase, CoinbaseFeeTransfer};
33//! use mina_signer::CompressedPubKey;
34//!
35//! // Create a coinbase transaction
36//! let receiver = CompressedPubKey::empty();
37//! let amount = Amount::new(720_000_000_000); // 720 MINA
38//!
39//! let coinbase = Coinbase::new(receiver, amount);
40//! assert!(!coinbase.has_fee_transfer());
41//! ```
42
43#![deny(clippy::all)]
44#![deny(clippy::pedantic)]
45#![deny(clippy::nursery)]
46#![cfg_attr(not(feature = "std"), no_std)]
47
48pub mod coinbase;
49pub mod currency;
50
51// Re-export main types at crate root for convenience
52pub use coinbase::{Coinbase, CoinbaseFeeTransfer};
53pub use currency::{Amount, Fee, Magnitude, Sign, Signed};