Expand description
Generic driver for Action Layer (CHIP-0050) spend construction
This crate provides utilities for building spends that use the Action Layer pattern:
PuzzleModule- Load and curry puzzles with typed argumentsActionLayerConfig- Configure and build action layer spends- Singleton helpers for building singleton spends with action layer inner puzzles
§Design Philosophy
This crate is designed to work with caller-provided curry args types. The key pattern is:
ⓘ
// Caller defines their own curry args struct with #[clvm(curry)]
#[derive(Debug, Clone, ToClvm, FromClvm)]
#[clvm(curry)]
pub struct MyCurryArgs {
pub some_hash: Bytes32,
}
// Use PuzzleModule to curry and hash
let puzzle = PuzzleModule::from_hex(MY_PUZZLE_HEX);
let curried_hash = puzzle.curry_tree_hash(MyCurryArgs { some_hash });
let curried_ptr = puzzle.curry_puzzle(ctx, MyCurryArgs { some_hash })?;Structs§
- Action
Layer Config - Configuration for building action layer spends.
- Action
Spend Result - Result of an action spend (generic over action-specific output)
- Child
Launch Result - Result of spawning a child singleton via ephemeral launcher
- Coin
- Coin
Spend - EveProof
- FeeOptions
- Fee configuration for spend bundles
- Launch
Result - Result of launching a singleton
- Lineage
Proof - Melted
- Marker type for actions that melt (destroy) the singleton
- NoOutput
- Marker type for actions that produce no specific output
- NodePtr
- Puzzle
Module - A compiled puzzle module that can be curried with typed arguments.
- Singleton
Coin - Tracks an on-chain singleton’s current state
- Singleton
Driver - Core driver for Action Layer singletons.
- Spend
Context - A wrapper around
Allocatorthat caches puzzles and keeps track of a list ofCoinSpend. It’s used to construct spend bundles in an easy and efficient way. - Spend
Options - Options for spend bundle handling
- Tree
Hash
Enums§
- Driver
Error - Proof
- Singleton
Lineage - Lineage information for generating proofs
Constants§
- SINGLETON_
LAUNCHER_ PUZZLE_ HASH - Singleton launcher puzzle hash (standard)
Functions§
- build_
singleton_ puzzle - Build a singleton puzzle NodePtr
- build_
singleton_ solution - Build a singleton solution NodePtr
- child_
singleton_ puzzle_ hash - Compute the puzzle hash for a child singleton given its launcher ID and inner puzzle hash
- create_
eve_ proof - Create an eve proof for the first singleton spend (after launch)
- create_
lineage_ proof - Create a lineage proof for subsequent singleton spends
- create_
singleton_ coin_ spend - Create and insert a singleton coin spend
- expected_
child_ launcher_ id - Compute the expected child launcher ID given the parent singleton coin ID
- launch_
singleton - Launch a new singleton with the given inner puzzle hash
- singleton_
puzzle_ hash - Compute the full singleton puzzle hash given launcher_id and inner puzzle hash
- spawn_
child_ singleton - Spawn a child singleton via ephemeral (0-amount) launcher.