action_layer_driver/lib.rs
1//! Generic driver for Action Layer (CHIP-0050) spend construction
2//!
3//! This crate provides utilities for building spends that use the Action Layer pattern:
4//! - `PuzzleModule` - Load and curry puzzles with typed arguments
5//! - `ActionLayerConfig` - Configure and build action layer spends
6//! - Singleton helpers for building singleton spends with action layer inner puzzles
7//!
8//! # Design Philosophy
9//!
10//! This crate is designed to work with caller-provided curry args types. The key pattern is:
11//!
12//! ```rust,ignore
13//! // Caller defines their own curry args struct with #[clvm(curry)]
14//! #[derive(Debug, Clone, ToClvm, FromClvm)]
15//! #[clvm(curry)]
16//! pub struct MyCurryArgs {
17//! pub some_hash: Bytes32,
18//! }
19//!
20//! // Use PuzzleModule to curry and hash
21//! let puzzle = PuzzleModule::from_hex(MY_PUZZLE_HEX);
22//! let curried_hash = puzzle.curry_tree_hash(MyCurryArgs { some_hash });
23//! let curried_ptr = puzzle.curry_puzzle(ctx, MyCurryArgs { some_hash })?;
24//! ```
25
26mod action_layer;
27mod error;
28mod puzzle;
29mod singleton;
30
31pub use action_layer::ActionLayerConfig;
32pub use error::DriverError;
33pub use puzzle::PuzzleModule;
34pub use singleton::*;
35
36// Re-export commonly used types from dependencies
37pub use chia::protocol::{Bytes32, Coin, CoinSpend};
38pub use chia::puzzles::{EveProof, LineageProof, Proof};
39pub use chia_wallet_sdk::driver::SpendContext;
40pub use clvm_utils::TreeHash;
41pub use clvmr::NodePtr;