chia-sdk-types 0.22.1

Standard Chia types for things such as puzzle info and conditions.
Documentation
use chia_protocol::Bytes32;
use chia_puzzles::{REVOCATION_LAYER, REVOCATION_LAYER_HASH};
use clvm_traits::{FromClvm, ToClvm};
use clvm_utils::TreeHash;

use crate::Mod;

#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)]
#[clvm(curry)]
pub struct RevocationArgs {
    pub mod_hash: Bytes32,
    pub hidden_puzzle_hash: Bytes32,
    pub inner_puzzle_hash: Bytes32,
}

impl RevocationArgs {
    pub fn new(mod_hash: Bytes32, hidden_puzzle_hash: Bytes32, inner_puzzle_hash: Bytes32) -> Self {
        Self {
            mod_hash,
            hidden_puzzle_hash,
            inner_puzzle_hash,
        }
    }
}

impl Mod for RevocationArgs {
    const MOD_REVEAL: &[u8] = &REVOCATION_LAYER;
    const MOD_HASH: TreeHash = TreeHash::new(REVOCATION_LAYER_HASH);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)]
#[clvm(solution)]
pub struct RevocationSolution<P, S> {
    pub hidden: bool,
    pub puzzle: P,
    pub solution: S,
}

impl<P, S> RevocationSolution<P, S> {
    pub fn new(hidden: bool, puzzle: P, solution: S) -> Self {
        Self {
            hidden,
            puzzle,
            solution,
        }
    }
}