Crate action_layer_driver

Crate action_layer_driver 

Source
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 arguments
  • ActionLayerConfig - 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§

ActionLayerConfig
Configuration for building action layer spends.
ActionSpendResult
Result of an action spend (generic over action-specific output)
ChildLaunchResult
Result of spawning a child singleton via ephemeral launcher
Coin
CoinSpend
EveProof
FeeOptions
Fee configuration for spend bundles
LaunchResult
Result of launching a singleton
LineageProof
Melted
Marker type for actions that melt (destroy) the singleton
NoOutput
Marker type for actions that produce no specific output
NodePtr
PuzzleModule
A compiled puzzle module that can be curried with typed arguments.
SingletonCoin
Tracks an on-chain singleton’s current state
SingletonDriver
Core driver for Action Layer singletons.
SpendContext
A wrapper around Allocator that caches puzzles and keeps track of a list of CoinSpend. It’s used to construct spend bundles in an easy and efficient way.
SpendOptions
Options for spend bundle handling
TreeHash

Enums§

DriverError
Proof
SingletonLineage
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.

Type Aliases§

Bytes32