chia_protocol/
coin_spend.rs

1use chia_streamable_macro::streamable;
2
3use crate::coin::Coin;
4use crate::program::Program;
5#[cfg(feature = "py-bindings")]
6use pyo3::prelude::*;
7#[cfg(feature = "py-bindings")]
8use pyo3::types::PyType;
9
10#[streamable]
11pub struct CoinSpend {
12    coin: Coin,
13    puzzle_reveal: Program,
14    solution: Program,
15}
16
17#[cfg(feature = "py-bindings")]
18#[pymethods]
19impl CoinSpend {
20    #[classmethod]
21    #[pyo3(name = "from_parent")]
22    pub fn from_parent(cls: &Bound<'_, PyType>, py: Python<'_>, cs: Self) -> PyResult<PyObject> {
23        // Convert result into potential child class
24        let instance = cls.call1((cs.coin, cs.puzzle_reveal, cs.solution))?;
25
26        Ok(instance.into_pyobject(py)?.unbind())
27    }
28}